The module command

Several software components (compiler, libraries, software, etc.) are already available on the fusion cluster. If you do not find what you want, you should to ask the support team to make it available for you.

The module command allows you to customize your environment according to your usage by charging modules. Each loaded module updates your environment variables (such as your $PATH variable) to make a software component reachable by your code.

Available modules

The module avail command lists all the available modules installed on Fusion. Note that each module comes with its specific version.

$ module avail
------------------ /gpfs/softs/modules/modulefiles/compilers -------------------
   gcc/9.2.0/gcc-4.8.5    intel/19.0.3/gcc-4.8.5    pgi/20.1/gcc-4.8.5

----------- /gpfs/softs/modules/modulefiles/debuggers_and_profilers ------------
   gdb/9.1/gcc-9.2.0

------------------ /gpfs/softs/modules/modulefiles/languages -------------------
   anaconda3/2020.02/gcc-9.2.0             openjdk/11.0.2/gcc-9.2.0
   miniconda2/4.7.12.1/intel-19.0.3.199    python/3.7.6/intel-19.0.3.199
   miniconda3/4.7.12.1/intel-19.0.3.199    scilab/6.1.0/gcc-9.2.0

------------------ /gpfs/softs/modules/modulefiles/libraries -------------------
   boost/1.70.0/intel-19.0.3.199-intel-mpi
   boost/1.70.0/intel-19.0.3.199
   cuda/10.0.130/intel-19.0.3.199
   cuda/10.1.243/intel-19.0.3.199
   cuda/10.2.89/intel-19.0.3.199
   cuda/9.2.88/intel-19.0.3.199
   hdf5/1.10.6/intel-19.0.3.199-intel-mpi
   hdf5/1.10.6/intel-19.0.3.199
   hdf5/1.8.21/intel-19.0.3.199-intel-mpi
   intel-mkl/2019.3.199/intel-19.0.3.199
   intel-mpi/2019.3.199/intel-19.0.3.199
   metis/5.1.0/intel-19.0.3.199-int32-real64
   metis/5.1.0/intel-19.0.3.199-int64-real64
   parmetis/4.0.3/intel-19.0.3.199-intel-mpi-int32-real64
   petsc/3.12.3/intel-19.0.3.199-intel-mpi
   scotch/6.0.8/intel-19.0.3.199-intel-mpi

-------------------- /gpfs/softs/modules/modulefiles/other ---------------------
   avbp/7.0/intel-19.0.3.199      julia/1.4.0/gcc-9.2.0
   gmsh/4.4.1/intel-19.0.3.199    paraview/5.8.0/gcc-9.2.0

-------------------- /gpfs/softs/modules/modulefiles/tools ---------------------
   cmake/3.16.2/gcc-9.2.0           git/2.25.0/gcc-9.2.0
   cmake/3.16.2/intel-19.0.3.199    gmake/4.2.1/gcc-9.2.0

You can add an argument to list all the versions for a specific product:

$ module avail hdf5

------------------ /gpfs/softs/modules/modulefiles/libraries -------------------
   hdf5/1.10.6/intel-19.0.3.199-intel-mpi
   hdf5/1.10.6/intel-19.0.3.199
   hdf5/1.8.21/intel-19.0.3.199-intel-mpi

The module names contains 3 informations:

  • The product name (hdf5)
  • The product version (1.10.6)
  • How this product has been built (compiled with intel-19.0.3.199-intel-mpi)

Load a module

The module load command adds one or more modules to your current session.

$ module load intel/19.0.3/gcc-4.8.5
$ module load intel-mkl/2019.3.199/intel-19.0.3.199
$ module load intel-mpi/2019.3.199/intel-19.0.3.199

List loaded modules

The module list command lists the modules which are currently loaded in your environment.

$ module load intel/19.0.3/gcc-4.8.5
$ module load intel-mkl/2019.3.199/intel-19.0.3.199
$ module load intel-mpi/2019.3.199/intel-19.0.3.199
$ module list
 Currently Loaded Modules:
  1) intel/19.0.3/gcc-4.8.5
  2) intel-mkl/2019.3.199/intel-19.0.3.199
  3) intel-mpi/2019.3.199/intel-19.0.3.199

Unload a module

The module unload option unloads a software component (make it unreachable by your environment by removing the proper paths from your environment variables).

$ module unload intel-mpi/2019.3.199/intel-19.0.3.199
$ module list
Currently Loaded Modulefiles:
Currently Loaded Modules:
  1) intel/19.0.3/gcc-4.8.5   2) intel-mkl/2019.3.199/intel-19.0.3.199

The module purge option unloads all loaded software components.

$ module purge
$ module list
No Modulefiles Currently Loaded.

Load a set of modules

Not recommanded: If you have to load a list of modules, we highly recommend not to add them to your personal startup files (in Bash : .bash_profile, .bash_login, .bashrc):

  • a call to module load takes non negligible time whether the module was already loaded or not.

  • When specified in ~/.bashrc, these commands are executed for each Bash script or shell execution!

  • Undesirable side effects may occur (see Visualization interface - Troubleshooting).

Recommanded: Several tips can be used to load a set of modules:

  • build a file containing the list of loading modules, read and execute them manually with the Bash source command. For example a file can contain a specific environment for a code in order to have the same environment at compilation and execution time (in a Slurm script):
$ cat code_env
module purge
module load intel/19.0.3/gcc-4.8.5
module load intel-mkl/2019.3.199/intel-19.0.3.199
module load intel-mpi/2019.3.199/intel-19.0.3.199
$ source code_env             # load the set of modules saved in code_env file
$ module list
  • The collection mechanism of module (saveand restore) allows to define a set of modules to be loaded manually:
$ module purge
$ module load intel/19.0.3/gcc-4.8.5
$ module load intel-mkl/2019.3.199/intel-19.0.3.199
$ module load intel-mpi/2019.3.199/intel-19.0.3.199
$ module list
$ module save code_env        # save the currently loaded modules in the collection named code_env

Then module restore makes it easy to load again this collection of modules in another Bash session:

module restore code_env       # load the collection of modules (named code_env) for your code

Other options can manage the collection of modules:

$ module savelist             # print the list of saved collections
$ module disable code_env     # remove the collection named code_env

For further information, see module --help.