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
.
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/modulefiles/Core ---------------------------------------------------------------------------
crystal/09.1.0.1 intel/2019.1.144 mkl/2019.1.144 mpich plask/openblas qchem/mpich
crystal/09.2.0.1 intel/2021.1.1 (L,D) mkl/2020.0.166 openmpi/2.1.0 python/default qchem/openmp
crystal/17.1.0.2 (D) meep (L) mkl/2021.1.1 (L,D) openmpi/4.0.3rc4 (D) python/2.7 qchem/serial (D)
intel/2013.2.146 mkl/default mpb (L) plask/mkl (L,D) python/3.8 (D) turbomole
------------------------------------------- /usr/share/lmod/lmod/modulefiles/Core -------------------------------------------------------------------
lmod/6.6 settarg/6.6
Where:
L: Module is loaded
D: Default Module
The command to list loaded modules/packages is module list
:
$ module list
Currently Loaded Modules:
1) intel/2021.1.1 2) meep 3) mpb 4) mkl/2021.1.1 5) plask/mkl
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) intel/2021.1.1 2) meep 3) mpb 4) mkl/2021.1.1 5) plask/mkl 6) crystal/17.1.0.2
To display what environmental variables have been set in a module use command
module display [modulename]
:
$ module display crystal
-----------------------------------------------------------------------------------------------------------------------------------------------
/opt/modulefiles/Core/crystal/17.1.0.2.lua:
-----------------------------------------------------------------------------------------------------------------------------------------------
help([[
This module loads CRYSTAL.
]])
whatis("Name: crystal ")
whatis("Description: This module loads CRYSTAL. ")
whatis("Version: 17.1.0.2 ")
setenv("CRY_EXEDIR","/opt/crystal/Linux-ifort17_XE_emt64/v1.0.2")
setenv("CRY_SCRDIR","/tmp")
setenv("CRY_MPIBIN","/opt/openmpi-2.1.0/bin/mpirun")
prepend_path("PATH","/opt/crystal/bin")
family("crystal")
To display basic help information for a module use help
subcommand:
$ module help [modulefile]
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) intel/2021.1.1 2) meep 3) mpb 4) mkl/2021.1.1 5) plask/mkl
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.