Environment Modules User Guide

Environment Modules is a utility for the dynamic modification of a user’s environment via modulefiles. There is a modulefile for each of available software packages installed on the system. Therefore, users may use the module command to check available software on the system. Users can issue a module command to dynamically set or remove shell environment variables such as PATH, INCLUDE, LD_LIBRARY_PATH, MANPATH, etc. for the corresponding software package/version. Users may put a module command in the job script file as needed, and can also add a module command into their ~/.bashrc.

Check available modules/packages

The command to check the module files for installed software packages is

$ module avail

More module files will become available when software packages are added.

Example:

$ module avail

------------------- /opt/ohpc/pub/moduledeps/gnu-mpich -------------------
   adios/1.10.0        mumps/5.0.2             scalasca/2.3.1
   boost/1.61.0        netcdf/4.4.1            scipy/0.18.0
   fftw/3.3.4          netcdf-cxx/4.2.1        scorep/3.0
   hypre/2.10.1        netcdf-fortran/4.4.4    sionlib/1.7.0
   imb/4.1             petsc/3.7.0             superlu_dist/4.2
   mpi4py/2.7   (L)    phdf5/1.8.17            tau/2.26
   mpiP/3.4.1          scalapack/2.0.2         trilinos/12.6.4

---------------------- /opt/ohpc/pub/moduledeps/gnu ----------------------
   R_base/3.3.1        mvapich2/2.2           pdtoolkit/3.22
   gsl/2.2.1           numpy/1.11.1           plask          (L)
   hdf5/1.8.17         ocr/1.0.1              pslab
   metis/5.1.0         openblas/0.2.19 (L)    superlu/5.2.1
   mpich/3.2    (L)    openmpi/1.10.4

----------------------- /opt/ohpc/pub/modulefiles ------------------------
   EasyBuild/2.9.0           gnu/5.4.0  (L)    pylab/2.7       (L)
   autotools          (L)    ohpc       (L)    valgrind/3.11.0
   clustershell/1.7.2        papi/5.4.3
   crystal                   prun/1.1   (L)

  Where:
   L:  Module is loaded

List loaded modules/packages

The command to list loaded modules/packages is module list:

$ module list

Currently Loaded Modules:
  1) autotools   4) mpich/3.2         7) pylab/2.7
  2) prun/1.1    5) mpi4py/2.7        8) plask
  3) gnu/5.4.0   6) openblas/0.2.19   9) ohpc

Load/add a module to set the environmental variables

The command to set the environmental variables for a software package is module load [modulefile]. You may check the loaded modules using module list after you load a module/package.

$ module load crystal
$ module list

Currently Loaded Modules:
  1) autotools   4) mpich/3.2         7) pylab/2.7  10) crystal
  2) prun/1.1    5) mpi4py/2.7        8) plask
  3) gnu/5.4.0   6) openblas/0.2.19   9) ohpc

To display what environmental variables have been set in a module use command module display [modulename]:

$ module display crystal

----------------------------------------------------------------------
   /opt/ohpc/pub/modulefiles/crystal:
----------------------------------------------------------------------
whatis("Name: pylab ")
whatis("Description: This module loads CRYSTAL. ")
whatis("Version: 09 ")
prereq_any("mpich")
setenv("CRY_EXEDIR","/opt/ohpc/pub/crystal/Linux_mpich2_amd64/v1_0_1")
setenv("CRY_SCRDIR",".")
prepend_path("PATH","/opt/ohpc/pub/crystal/bin")
family("crystal")
help([[
This module loads CRYSTAL.
]])

To display basic help information for a module use help subcommand:

$ module help [modulefile]

Unload/remove a module from the shell environment

The command to unset the environmental variables for a software package is module unload [modulefile]. You may check the loaded modules using module list after you unload the module/package.

$ module unload crystal
$ module list

Currently Loaded Modules:
  1) autotools   4) mpich/3.2         7) pylab/2.7
  2) prun/1.1    5) mpi4py/2.7        8) plask
  3) gnu/5.4.0   6) openblas/0.2.19   9) ohpc

Unload all loaded modules

The command to unload all the loaded modules is module purge.

$ module purge

ml: a convenient tool

For those of you who can’t type the mdoule, moduel, err module command correctly, Lmod has a tool for you. With ml you won’t have to type the module command again. The two most common commands are module list*and *module load <something> and ml does both:

$ ml

means module list. And:

$ ml foo

means module load foo while:

$ ml -bar

means module unload bar. It won’t come as a surprise that you can combine them:

$ ml foo -bar

means module unload bar; module load foo. You can do all the module commands:

$ ml spider
$ ml avail
$ ml show foo

If you ever have to load a module name spider you can do:

$ ml load spider

If you are ever force to type the module command instead of ml then that is a bug and should be reported.