lmod: environment module system

In the cluster you can find a collection of software such as compilers, mathematical libraries, tools, scientific programs, etc.

Because this collection is extensive and that a user does not usually need all the software, a system of environment modules has been implemented that allows handling the software that is loaded.

The module command sets the environment variables for user sessions.

Available modules

$ module avail

Load module

$ module load nombre

Show loaded modules

$ module list

Swap two modules

It is useful when we want to change the compiler. Example:

$ module swap gcc intel

Also, all compiler dependent libraries/applications will be changed.

Stop using a module

$ module unload nombre

Get help

The modules contain small user guides of the corresponding applications / libraries, which can be consulted with:

$ module help nombre

Search modules

$ module spider palabraclave

Default modules

There are a number of modules that are loaded by default:

  • GCC/6.4.0-2.28

Modules and SLURM

When a program is launched in SLURM, all the environment variables that are loaded at the time of submission are copied to the execution node. For example, if the MPI module is loaded at the time of shipment, it will also be available on the execution node.

However, if they are not loaded and the job requires them, it would need to be added to the SLURM description script:

#SBATCH -N 2 #(solicita dos nodos)
#SBATCH -n 2 #(dos tareas en total)
#SBATCH -p short #(solicita la partición específica)
#SBATCH -t 00:00:30 #(30 sec ejecución)

module load intel
srun programa


Modifications made to environment variables when using module are temporary and are lost when logging out. At the beginning of each session, they will have to be reloaded.

If a module is used, it may usually be preferable to add it to the shell profile, for example, .bashrc.


Do you need more info?