Lmod automatically loads a default set of modules, including compiler, network, CPU, and MPI modules, while users may choose to load a different module set. The module
function of the Environment Modules package provides a user interface to Lmod as well: you can use module
with the arguments avail
(case insensitive search for available modules), list
(list the loaded modules), load
(add modules), switch
(swap modules), unload
(remove modules). Additionally, Lmod provides the command ml
:
$ ml means: module list $ ml cray-fftw cray-hdf5-parallel cray-netcdf-hdf5parallel means: module load cray-fftw cray-hdf5-parallel cray-netcdf-hdf5parallel $ ml -cray-hdf5 craype-hugepages8M cray-R means: module unload cray-hdf5 module load craype-hugepages8M cray-R
The command ml
can replace the module
command. Shortening module
commands is also possible when there is no ambiguity: for instance, ml av
will work as module avail
.
Module hierarchy
Lmod adjusts the MODULEPATH
in order to link libraries built with one compiler with applications built with the same compiler version. When a particular compiler is loaded, you only see modulefile(s) that are valid for that compiler: if you swap compilers, then Lmod automatically unloads any modules that depend on the old compiler and reloads those modules that are dependent on the new compiler. If a modulefile is not available with the new compiler, then the module is marked as inactive.
Every time the MODULEPATH
changes, Lmod attempts to reload any inactive modules. The command module avail
reports only the modules that are in the current MODULEPATH
and that the user can load. With the modulefile hierarchy, a package that the user wants may be available but not with the current compiler version. Lmod offers the command module spider
to search the entire list of possible modules and not just the modules that can be seen in the current MODULEPATH
. The command has three modes:
$ module spider First mode: Compact listing of all modules on the system $ module spider cray-netcdf Second mode: description of a specific module name $ module spider cray-netcdf/4.8.1.1 Third mode: reports how to load a specific module version
The Lmod commands module avail
and module spider
perform a case insensitive search of the selected module. However, you will need to type the module name with the correct letter case when using the commands module load
and module unload
.
Module collections
Lmod offers the possibility to create user collections: the module list of the current session will be saved with the command module save <collection_name>
and it can be restored at a later stage with the command module restore <collection_name>
. User collections will be stored in the local Lmod user profile under ~/.lmod.d
: if a module collection is saved without a name, then the user's default collection is set in
~/.lmod.d/default
. The user's default collection is useful to define an initial list of login modules: the command module restore
with no arguments will load the saved modules of the user's default collection. Please note that the module
commands avail
, load
, switch
and unload
do not work with module collections, while the following should be used:
$ module save <collection> Save current module list to a named collection $ module restore <collection> Load the modules of the saved named collection $ module describe <collection> Print the content of a named collection
Please check the Lmod User Guide for more information on the module commands and an in-depth description of the module hierarchy.