Skip to content. | Skip to navigation

Personal tools

You are here: Home / Using “module” command

Using “module” command

The module command is used to load environment for various software, like compilers, MPI libreries etc.

 

The module command will let you load and unload the environment needed to run specific applications or use specific libraries. It is especially useful when you need to have different versions of the same software/library or the same software/library compiled against different compilers.

In our cluster, for instance, we have both GNU and Intel compilers, therefore, in order to use MPI when we compile using one of those compilers we need to have two different versions of OpenMPI, but instead of having binaries name like mpicc-1.4.3-intel-11.1 or similar we use module to update the PATH environment variable, so that after loading the specific module for openmpi/intel we will just run mpicc and mpirun.

HOWTO

The syntax of the module command is the following:

    module <subcommand> [<arguments>]

<subcommand> may or may not require one or more <arguments>

A partial list of available subcommands follows:

  • list to list the currently loaded modules,
  • avail to list all the available modules
  • load to load one or more modules
  • unload to unload one or more modules
  • purge to unload all the currently loaded modules

A detailed list of all subcommands is shown by running the command module help

The output of the module avail command could be something like:

$ module avail

---------------- /opt-ictp/ohpc/modulefiles/mpi ----------------
gnu-openmpi/boost/1.63.0
gnu-openmpi/fftw/3.3.4
gnu-openmpi/netcdf-cxx/4.3.0
gnu-openmpi/netcdf-fortran/4.4.4
gnu-openmpi/netcdf/4.4.1.1
gnu-openmpi/phdf5/1.8.17
gnu-openmpi/scalapack/2.0.2
gnu-openmpi/scipy/0.19.0
intel-mpi/2016
openmpi/1.10.2/intel/2013
openmpi/1.10.2/intel/2016
openmpi/1.10.2/intel/2017        (D)
openmpi/1.6.5/intel/2013
openmpi/gnu
openmpi/intel

--------------- /opt-ictp/ohpc/modulefiles/libs ----------------
boost/1.55
boost/1.60                  (D)
cln/1.3.2
esmf/7.0.0
gabriel/1.2
gmp/4.3.2/default-compiler
gmp/default-compiler
grib_api/intel              (D)
grib_api/1.12.0/intel
grib_api/1.23.1/intel
hdf5/intel                  (D)
hdf5/1.8.12/intel
hdf5/1.8.19/intel
iml/1.0.3/gnu/4.4.0
intel-mkl/2017
mpc/0.9/default-compiler
mpc/default-compiler
mpfr/3.0.0/default-compiler
mpfr/default-compiler
netcdf/intel                (D)
netcdf/4.3.1/intel/2013
netcdf/4.4.1/intel/2017
plasma/2.6.0

------------- /opt-ictp/ohpc/modulefiles/compilers -------------
cuda/5.5                intel/2013       (D)
cuda/6.5                intel/2016
cuda/9.1         (D)    intel/2017
default-compiler        nocomp
g++_addon/4.9.0         opencl-amd
gcc/4.4.7               opencl-intel
gcc/4.5.2               opencl/amd/2.8
gcc/4.6.2               opencl/intel/1.2
gcc/4.9.0        (D)    pgi/10.9
gnat/2014               pgi/16.10        (D)
gnu/5.4.0               pgi/18.4
gnu7/7.2.0

--------------- /opt-ictp/ohpc/modulefiles/apps ----------------
PHCpack/2.3.95
R/2.15                          (D)
R/3.1.2
R/3.3.1
R/3.5.1
alps/2.1.1
anaconda3/5.1.0
cdo/1.9.0
cp2k/2.4                        (D)
cp2k/2.6.1
espresso/5.1                    (D)
espresso/5.2.1
espresso/6.2.1
ferret/v6.842
gdal/1.7.3
gdal/2.2.4
gdal/2.3.0
gdal/2.3.1                      (D)
gdl/0.9.4/intel
gengetopt/2.22/default-compiler
glpk/4.45/gnu/4.4.0
gnu/gsl/2.2.1
gnu/hdf5/1.8.17
gnu/numpy/1.11.1
gnu/openblas/0.2.19
gnu/openmpi/1.10.6
grads/binary
gromacs/2016.3
lhapdf/5.8.6/default-compiler
maple/14
matlab/r2011
ncl/5.2.1/gnu/4.4.7
ncl/6.0.0/gnu/4.4.7
ncl/6.3.0/gnu/4.4.7
nco/intel                       (D)
nco/4.4.2/intel
nco/4.6.8/intel
nwchem/6.5
proj/4.7.0
proj/5.1.0                      (D)
python/esp
python/2.7.13                   (D)
root/5.30.04/default-compiler
root/6.08.06

------------------ /opt/ohpc/pub/modulefiles -------------------
autotools        (L)    gnu7/7.2.0         papi/5.5.1
clustershell/1.8        llvm4/4.0.1        pmix/1.2.3
cmake/3.9.2             llvm5/5.0.0        prun/1.1
gnu/5.4.0               ohpc        (L)    prun/1.2   (L,D)

Where:
D:  Default Module
L:  Module is loaded

The syntax used for module names is usually:program_name/program_version/compiler_name/compiler_version.

To load, e.g., the openmpi module for the intel compiler you can then run module load openmpi/intel. If you then run the command module list you will see:

$ module load openmpi/intel

$ module list
Currently Loaded Modulefiles:
1) intel/2013 2) openmpi/intel

as expected, the intel module has been loaded automatically since openmpi requires it.