Skip to content

Module system

VSC uses a module system, it allows for the dynamic adding and removal of installed software packages to the running environment. To access, list and search among the installed application programs, libraries, and tools, use the module command:

module --help         General help with module commands

module avail          List the available modules and recommendations

module load ...        Load the selected modules into your session (can also write: module add)

module list           List your currently loaded modules (will be flushed at logout)

module rm ...         Remove selected modules from your session

module purge          Remove all loaded modules

Modules is a convenient way of making different versions of one piece of software available, and can define or change environment variables required for using a piece of software:

PATH
CPATH
LIBRARY_PATH
LD_LIBRARY_PATH
...

Find modules

Use module avail to find installations of a package:

module avail intel-oneapi-mpi

This is similar to spack find, and often shows the same packages.

Info

Package names are case sensitive, like Matlab, Mathematica, ...

Load your module

Use module load to load your package:

skylake$ module load openmpi/4.1.4-gcc-12.2.0-xt53foa

Always state the whole line:

skylake$ module load openmpi/4.1.4
ERROR: Unable to locate a modulefile for 'openmpi/4.1.4'

Module names differ depending on cluster (CPU architecture):

skylake$ module load python/3.11.3-gcc-12.2.0-rtzvjko
zen$ module load python/3.11.3-gcc-12.2.0-hn7p65z
cuda-zen$ module load python/3.9.15-gcc-12.2.0-dnctq7y

List loaded modules

Type module list to show loaded modules:

module list -t
Currently Loaded Modulefiles:
netlib-lapack/3.10.1-gcc-12.2.0-4qrxbdw
python/3.9.15-gcc-12.2.0-my6jxu2
py-setuptools/63.0.0-gcc-12.2.0-jru4czh
py-numpy/1.24.3-gcc-12.2.0-muackhh
...

Unload & remove modules

Type module purge to remove all loaded modules:

module purge

Recommended in job scripts before loading any modules (reproducibility).

Use module rm or module unload to remove/unload a list of modules:

module rm <modulename> <modulename> ...
module unload <modulename> <modulename> ...

Inspect modules

Use module show to show the variables added to your environment by a module:

zen $ module show python/3.11.3-gcc-12.2.0-hn7p65z
-------------------------------------------------------------------
/opt/sw/zen/spack-0.19.0/share/spack/modules/linux-almalinux8-zen3...

module-whatis   {The Python programming language.}
prepend-path    PATH /gpfs/opt/sw/zen/spack-0.19.0/opt/spack/linux...
prepend-path    LIBRARY_PATH /gpfs/opt/sw/zen/spack-0.19.0/opt/spa...
prepend-path    CPATH /gpfs/opt/sw/zen/spack-0.19.0/opt/spack/linu...
prepend-path    MANPATH /gpfs/opt/sw/zen/spack-0.19.0/opt/spack/li...
...

There is no need to load a module to be able to inspec it.

Dependencies

Sometimes a module also needs dependencies:

zen $ module load py-numpy/1.24.3-gcc-12.2.0-muackhh
Loading py-numpy/1.24.3-gcc-12.2.0-muackhh
  Loading requirement: netlib-lapack/3.10.1-gcc-12.2.0-4qrxbdw
      python/3.9.15-gcc-12.2.0-my6jxu2
      py-setuptools/63.0.0-gcc-12.2.0-jru4czh

Add --auto to automatically load all the dependencies:

zen $ module load --auto py-numpy/1.24.3-gcc-12.2.0-muackhh

Tip

Write the line export MODULES_AUTO_HANDLING=1 to your ~/.bashrc to always load all dependencies, or to not load them automatically with export MODULES_AUTO_HANDLING=0.