Being a multiuser system by definition, a HPC cluster typically has much more software installed compared to a usual Desktop computer. Often these software packages are not installed in standard operating system paths and all software cannot be used simultaneously (conflicts, incompatibilities). A single software package or library may be installed in multiple different versions with different features enabled. In order to manage all software, the Lmod (= Lua modules) module system is used. Lmod provides a convenient way to dynamically change a user's environment through modules. This includes easily adding or removing directories to/from environment variables (e.g. PATH, LD_LIBRARY_PATH, etc.) or simply defining necessary environment variables. Central to using the Lmod system is the This command gives you a list of all available packages and their corresponding flags. The following flags will be shown: Build for usage with a GPU The spider command not only shows all packages containing a specific string ( The In sbatch-scripts, all values and modules in your environment will be propagated to your script and application. While this might seem a good thing at first, this often creates hard to debug errors or conflicts. It is therefore recommended to purge all modules in your sbatch-script and then load all the modules needed by your program. A sbatch-script should therefore typically look like this: Lmod allows you to load modules with varying specificity. If only the base name (shortName) is specified, then Lmod will load either the module with the highest version or the module marked as default by the HPC-Team. You can also increase specificity by providing the major version, the major+minor version or (if existent) the major+minor+bugfix version to load a module. In the first two cases, Lmod will automatically load the highest version compatible. If you want to disable lmod from being loaded automatically for personal reasons simply create a signaling file in your home directory. The next time you login, Lmod will not be available. Alternatively, you can use the Introduction
Basic Usage
module
command. The is also the ml
command for convenience which accepts all commands module
does, plus a few even shorter versions of it.module help
module list
ml
module overview
module ov
ml ov
module avail
module av
ml av
# show all available modules containing string "cuda"
ml av cuda
flag meaning (D) This is the default module (O) Obsolete module. Avoid using it as it will be removed soon. (g) # List all available modules (Level 0)
module spider
ml spider
# List all available modules containing "openmpi" (Level 1)
module spider openmpi
ml spider openmpi
# Show more details for the module specifying it full name (Level 2)
module spider openmpi/4.1.6
ml spider openmpi/4.1.6
openmpi
in the example above), but also those which will only become available when another (dependent) module is loaded. This is typically the case when modules use a hierarchical order. module load pkg1 pkg2
ml pkg1 pkg2
module unload pkg1 pkg2
ml -pkg1 -pkg2
ml
command even allows you to combine this: ml pkg1 -pkg2
(loads pkg1 and unloads pkg2)module purge
ml purge
module swap pkg1 pkg2 # short for module unload pkg1;module load pkg2
ml sw pkg1 pkg2
module swap pkg1 pkg2 # short for module unload pkg1;module load pkg2
ml sw pkg1 pkg2
module category
module cat
ml cat
module category lib
module cat lib
ml cat lib
Using Lmod in SBATCH scripts
#!/usr/bin/env bash
#SBATCH ...
module purge
module load pkg1 pkg2
# Then run your programm
srun program
Specifying which version of a module to load
module load cuda
module load cuda/12
module load cuda/12.1
module load cuda/12.1.1
Disabling Lmod
touch ~/.lmod_off
clearLmod
command to clear all Lmod variables, modules and functions from your environment.