Environment Modules (Lmod)
Introduction
Lmod is a software package that allows us to provide a multitude of applications and libraries in multiple versions on the UL HPC platform. The tool itself is used to manage environment variables such as PATH, LD_LIBRARY_PATH and MANPATH, enabling the easy loading and unloading of application/library profiles and their dependencies.
This introduction to Environment Modules is based on the excellent resources provided by Wolfgang Baumann and NERSC.
Module commands
Note The commands described below will only work on a compute node, therefore you first need to start an OAR job.
Module options (help)
To get the list of options provided by Lmod through the module
command type the following (the listing has been abbreviated to only those commands discussed in this webpage):
$ module help
Usage: module [options] sub-command [args ...]
[...]
Loading/Unloading sub-commands:
-------------------------------
load | add module [...] load module(s)
del | unload module [...] Remove module(s), do not complain if not found
purge unload all modules
[...]
Listing / Searching sub-commands:
---------------------------------
list List loaded modules
list s1 s2 ... List loaded modules that match the pattern
avail | av List available modules
avail | av string List available modules that contain "string".
spider List all possible modules
spider module List all possible version of that module file
spider string List all module that contain the "string".
[...]
Available modules overview (avail/av)
$ module avail
Rebuilding cache, please wait ... (written to file) done.
---------------------------------------------------------------------------------------- /opt/apps/resif/devel/v1.1-20150414/core/modules/bio -----------------------------------------------------------------------------------------
bio/ABySS/1.3.4-goolf-1.4.10-Python-2.7.3 bio/Bowtie2/2.0.2-ictce-5.3.0 bio/GROMACS/4.6.1-ictce-5.3.0-hybrid bio/SAMtools/0.1.18-ictce-5.3.0 bio/mpiBLAST/1.6.0-ictce-7.3.5
bio/ABySS/1.3.4-ictce-5.3.0-Python-2.7.3 bio/Bowtie2/2.2.2-goolf-1.4.10 (D) bio/GROMACS/4.6.1-ictce-5.3.0-mt bio/SAMtools/0.1.19-goolf-1.4.10
bio/ABySS/1.5.2-goolf-1.4.10 (D) bio/Cufflinks/2.0.2-goolf-1.4.10 bio/GROMACS/4.6.5-goolf-1.4.10-hybrid bio/SAMtools/0.1.19-ictce-5.3.0
[...]
This option lists all the modules which are available to be loaded. Notice that all of them have version numbers associated. Modules makes it easy to switch between (e.g. compiler) application versions. The modules are sorted into categories (see also Software), e.g. ‘bio’ for Biology-related applications or ‘vis’ for Visualisation software.
Search for a module (key/spider)
$ module key "search terms"
$ module key sequence
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
The following modules match your search criteria: "sequence"
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
bio/ABySS: bio/ABySS/1.3.4-goolf-1.4.10-Python-2.7.3, bio/ABySS/1.3.4-ictce-5.3.0-Python-2.7.3, bio/ABySS/1.5.2-goolf-1.4.10
Assembly By Short Sequences - a de novo, parallel, paired-end sequence assembler - Homepage: http://www.bcgsc.ca/platform/bioinfo/software/abyss
bio/Bowtie2: bio/Bowtie2/2.0.2-ictce-5.3.0, bio/Bowtie2/2.2.2-goolf-1.4.10
Bowtie 2 is an ultrafast and memory-efficient tool for aligning sequencing reads to long reference sequences. - Homepage: http://bowtie-bio.sourceforge.net/bowtie2/index.shtml
With Lmod it’s possible to search the module’s description field (with module key search_term
) in the current module hierarchy, and the full hierarchy by using module spider search_term
instead.
List loaded modules (list)
$ module list
Currently Loaded Modules:
1) DDT/4.1 2) debugger/TotalView/8.12.0-0-linux-x86-64
This command lists all the modules which are currently loaded into the users environment. Note: The listing is in load order.
Show a module’s help text (help)
$ module help modulefile
If a module looks interesting, to get more information use this command to display the help information contained within the given module file.
$ module help chem/QuantumESPRESSO/5.1.2-ictce-7.3.5
---------------------------------------------------------------------------------- Module Specific Help for "chem/QuantumESPRESSO/5.1.2-ictce-7.3.5" ----------------------------------------------------------------------------------
Quantum ESPRESSO is an integrated suite of computer codes
for electronic-structure calculations and materials modeling at the nanoscale.
It is based on density-functional theory, plane waves, and pseudopotentials
(both norm-conserving and ultrasoft). - Homepage: http://www.pwscf.org/
Display what a module does (display)
$ module display modulefile
Use this command to see exactly what a given modulefile will do to your environment, such as what will be added to the PATH, MANPATH, etc. environment variables.
$ module display chem/QuantumESPRESSO/5.1.2-ictce-7.3.5
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
/opt/apps/resif/devel/v1.1-20150414/core/modules/chem/chem/QuantumESPRESSO/5.1.2-ictce-7.3.5:
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
whatis("Description: Quantum ESPRESSO is an integrated suite of computer codes for electronic-structure calculations and materials modeling at the nanoscale. It is based on density-functional theory, plane waves, and pseudopotenti
als (both norm-conserving and ultrasoft). - Homepage: http://www.pwscf.org/ ")
conflict("chem/QuantumESPRESSO")
load("toolchain/ictce/7.3.5")
prepend_path("CPATH","/opt/apps/resif/devel/v1.1-20150414/core/software/chem/QuantumESPRESSO/5.1.2-ictce-7.3.5/espresso-5.1.2/include")
prepend_path("PATH","/opt/apps/resif/devel/v1.1-20150414/core/software/chem/QuantumESPRESSO/5.1.2-ictce-7.3.5/espresso-5.1.2/bin")
prepend_path("PATH","/opt/apps/resif/devel/v1.1-20150414/core/software/chem/QuantumESPRESSO/5.1.2-ictce-7.3.5/espresso-5.1.2/upftools")
prepend_path("PATH","/opt/apps/resif/devel/v1.1-20150414/core/software/chem/QuantumESPRESSO/5.1.2-ictce-7.3.5/espresso-5.1.2/WANT/bin")
[...]
Load a module (load)
$ module load modulefile
This adds one or more modulefiles to the user’s current environment. It does so silently, unless there is a problem with a modulefile. If there is problem, please notify us.
When loading an application you may specify a module name without a version number, in which case default version marked with a (D) in the module avail
listing will be loaded.
$ module load chem/QuantumESPRESSO
To load a specific version, load the module using its full specification, e.g.:
$ module load chem/QuantumESPRESSO/5.1.2-ictce-7.3.5
Unload a module (unload) or all modules (purge)
$ module unload modulefile
This removes the specified modules from the user’s current environment. The modules can be removed in any order.
$ module unload chem/QuantumESPRESSO/5.1.2-ictce-7.3.5
Some modules may load other modules as dependencies, to clean your environment of all loaded modules use:
$ module purge
Switch between two modules (switch/load)
$ module switch modulefile_old modulefile_new
This command demonstrates the true advantage of modules. The following example shows the statistical computing language R version before and after a module switch, where an old R version is switched out in favor of a newer one. This allows different R versions to be tried in a safe, reliable, and easy manner.
$ module load lang/R/3.0.2-ictce-5.3.0
$ R --version
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
[...]
$ module switch lang/R/3.2.0-ictce-7.3.5-Rmpi
The following have been reloaded with a version change:
1) compiler/icc/2013.3.163 => compiler/icc/2015.3.187 6) lib/libpng/1.6.6-ictce-5.3.0 => lib/libpng/1.6.17-ictce-7.3.5 11) toolchain/iccifort/2013.3.163 => toolchain/iccifort/2015.3.187
2) compiler/ifort/2013.3.163 => compiler/ifort/2015.3.187 7) lib/libreadline/6.2-ictce-5.3.0 => lib/libreadline/6.3-ictce-7.3.5 12) toolchain/ictce/5.3.0 => toolchain/ictce/7.3.5
3) devel/ncurses/5.9-ictce-5.3.0 => devel/ncurses/5.9-ictce-7.3.5 8) lib/zlib/1.2.7-ictce-5.3.0 => lib/zlib/1.2.8-ictce-7.3.5 13) toolchain/iimpi/5.3.0 => toolchain/iimpi/7.3.5
4) lang/Java/1.7.0_15 => lang/Java/1.8.0_25 9) mpi/impi/4.1.0.030-iccifort-2013.3.163 => mpi/impi/5.0.3.048-iccifort-2015.3.187
5) lang/R/3.0.2-ictce-5.3.0 => lang/R/3.2.0-ictce-7.3.5-Rmpi 10) numlib/imkl/11.0.3.163-iimpi-5.3.0 => numlib/imkl/11.2.3.187-iimpi-7.3.5
$ R --version
R version 3.2.0 (2015-04-16) -- "Full of Ingredients"
[...]
Using additional paths that contain modules (use)
As detailed on the software page, we provide a core set of applications by default to the users through the modules system, yet additional software sets may be created for/by specific groups.
To browse, load, etc. modules provided in a specific location, the module use
command is employed:
$ module use modulepath
$ module use $RESIF_ROOTINSTALL/lcsb/modules/all
As new applications and versions of application software become available, they will automatically become part of the environment, yet a local cache may need to be regenerated, using module --ignore_cache avail
.
Troubleshooting
- Lmod: user guide
- Lmod: advanced user guide
- Lmod: FAQ
- Have a look at FAQ or Report a problem