DCSC logo
 
ABOUT-DCSC
DCSC/SDU
DCSC/AU
DCSC/AAU
DCSC/DTU
DCSC/KU
 
+Open all         -Close all
 
 

Modules - HOWTO

What is modules?

It is often desirable to have multiple versions of the same software installed and usable at the same time. The modules package -- officially it is Environment Modules -- makes it very easy to specify which version you want to use. There are also circumstances where one software program will have some environment setting or file that conflicts with a different program, and modules also helps solve that problem.

What modules are available?

Most software that is available on our cluster can be found as a module. To see a list of software that is available, you can look at the Modules - Standard Software page.

You can also use the command module avail:

user@fe7:~$ module avail -------------------- /opt/sys/m/common/modulefiles --------------------- R/2.15.3(default) graphviz/2.32.0(default) numpy/1.7.1(default) amber/12(default) gromacs/4.6.1 openmpi/1.6.5 atlas/3.10.1(default) gromacs/4.6.2(default) openmpi/1.7.2(default) cmake/2.8.10.2 gromacs/4.6.3 pp/1.6.4(default) cmake/2.8.11(default) intelcc/12.0.2(default) python/2.7.4 fftw/3.3.3(default) ipython/0.13.2 python/2.7.5(default) gcc/4.6.4 ipython/1.0.0(default) python3/3.3.2(default) gcc/4.7.3(default) jed/0.99-19(default) scipy/0.12.0(default) gcc/4.8.1 mvapich2/2.0a(default) graphviz/2.30.1 namd/2.9(default) -------------------- /usr/share/Modules/modulefiles -------------------- dot module-cvs module-info modules null use.own

You can optionally specify a package name, and it will show you all the versions of that package available. For example, here is what it might look like for Gromacs:

user@fe7:~$ module avail gromacs -------------------- /opt/sys/m/common/modulefiles -------------------- gromacs/4.6.1 gromacs/4.6.2(default) gromacs/4.6.3

Note that there is a default version, as well as both an older and a newer one.

Load a module

To load a module, use the command module load modulename. The default version will get loaded. If you want a particular version, use module load modulename/version, e.g

user@fe7:~$ module list No Modulefiles Currently Loaded. user@fe7:~$ module load gromacs user@fe7:~$ module list Currently Loaded Modulefiles: 1) gcc/4.8.1 2) openmpi/1.7.2 3) gromacs/4.6.2 user@fe7:~$ module load gromacs/4.6.3 gromacs/4.6.3(20):ERROR:150: Module 'gromacs/4.6.3' conflicts with the currently loaded module(s) 'gromacs/4.6.2' gromacs/4.6.3(20):ERROR:102: Tcl command execution failed: conflict $name user@fe7:~$ module purge user@fe7:~$ module load gromacs/4.6.3 user@fe7:~$ module list Currently Loaded Modulefiles: 1) gcc/4.8.1 2) openmpi/1.7.2 3) gromacs/4.6.3

Note that in both cases above module load automatically loads dependencies. In this case gromacs depends on a specific version of gcc and openmpi.

Multiple modules can be loaded in a single command, e.g.

user@fe7:~$ module load python ipython numpy scipy user@fe7:~$ module list Currently Loaded Modulefiles: 1) python/2.7.5 2) ipython/1.0.0 3) numpy/1.7.1 4) scipy/0.12.0

Unload a module

To unload a module, use the command module unload modulename. To unload everything, use module purge

user@fe7:~$ module list Currently Loaded Modulefiles: 1) gcc/4.6.4 2) openmpi/1.7.2 3) gromacs/4.6.2 user@fe7:~$ module unload gromacs user@fe7:~$ module list Currently Loaded Modulefiles: 1) gcc/4.6.4 2) openmpi/1.7.2 user@fe7:~$ module list Currently Loaded Modulefiles: 1) intelcc/12.0.2 2) openmpi/1.7.2 3) fftw/3.3.3 4) cmake/2.8.11 user@fe7:~$ module purge user@fe7:~$ module list No Modulefiles Currently Loaded.

See what modules have been loaded

The command module list will show what modules have been loaded.

user@fe7:~$ module list Currently Loaded Modulefiles: 1) python/2.7.5 2) ipython/1.0.0

Examine a modulefile

If you want to see what the module command is doing to your environment, you can run

user@fe7:~$ module show gromacs ------------------------------------------------------------------- /opt/sys/m/common/modulefiles/gromacs/4.6.2: autoload gcc/4.6.4 autoload openmpi conflict gromacs prereq gcc/4.6.4 prereq openmpi module-whatis GROMACS is a collection of molecular dynamics simulation programs. prepend-path PATH /opt/sys/m/hs7/pkg/gromacs/4.6.2/bin prepend-path MANPATH /opt/sys/m/hs7/pkg/gromacs/4.6.2/share/man prepend-path LD_LIBRARY_PATH /opt/sys/m/hs7/pkg/gromacs/4.6.2/lib prepend-path LD_RUN_PATH /opt/sys/m/hs7/pkg/gromacs/4.6.2/lib prepend-path PKG_CONFIG_PATH /opt/sys/m/hs7/pkg/gromacs/4.6.2/lib/pkgconfig -------------------------------------------------------------------

Module dependencies

Some modules depend on other modules to work, e.g. the ipython module requires the python or python3 modules. module load ipython will try to autoload dependencies:

user@fe7:~$ module load ipython user@fe7:~$ module list Currently Loaded Modulefiles: 1) python/2.7.5 2) ipython/1.0.0 user@fe7:~$ module purge user@fe7:~$ module load python3 ipython user@fe7:~$ module list Currently Loaded Modulefiles: 1) python3/3.3.2 2) ipython/1.0.0

If this is not possible, an error message will be shown, enabling you to fix the problem yourself, e.g., Parallel Python only works with Python 2.x, and will not load if you have already loaded python3:

user@fe7:~$ module load python3 user@fe7:~$ module load pp python/2.7.5(18):ERROR:150: Module 'python/2.7.5' conflicts with the currently loaded module(s) 'python3/3.3.2' python/2.7.5(18):ERROR:102: Tcl command execution failed: conflict $name python3 Could not load required sub-module python (autoload) Please run 'module purge' and try again user@fe7:~$ module purge ; module load pp user@fe7:~$ module list Currently Loaded Modulefiles: 1) python/2.7.5 2) pp/1.6.4

Similarly, the MPI implementations and the libraries have been compiled/optimized for each of the compilers in our system.

You can either choose which version you want yourself, or let the MPI implementation or library use the default compiler (and MPI implementation if applicable).

user@fe7:~$ module load fftw user@fe7:~$ module list Currently Loaded Modulefiles: 1) gcc/4.7.3 2) openmpi/1.7.2 3) fftw/3.3.3 user@fe7:~$ module purge user@fe7:~$ module load intelcc mvapich2 fftw user@fe7:~$ module list Currently Loaded Modulefiles: 1) intelcc/12.0.2 2) mvapich2/2.0a 3) fftw/3.3.3

Using modules in scripts

The module command can be used in any batch script or other script. A typical script would be

#! /bin/bash ## PBS commands ## ... module load somemodule ... somecommands

Further reading

The module command can be used in any batch script or other script. A typical script would be