User Tools

Site Tools


Environment Modules

Environment modules are used to define environment variables for applications available on Magi. Formerly, we used lmod. We moved to environment modules in the current version of Magi. All modules are stored in /softs/modules.

In this directory, we find 4 subdirectories :

  • intel : Intel compiler's modules
  • slurm : SLURM job scheduler module
  • packages : Pre-compiled softwares (such as Matlab, CPLEX etc.)
  • compiled : Compiled software (such as OpenMPI, VASP etc.)

The compiled subdirectory reflects the way the software has been built. For instance, we have OpenMPI module located in gcc/10.2.1/openmpi/4.1.2 it means that OpenMPI version 4.1.2 has been compiled with gcc version 10.2.1.

To enable a module, for example OpenMPI, you use the module command with load :

 nicolas.greneche@magi3:~$ module load /softs/modules/compiled/gcc/10.2.1/openmpi/4.1.2

To list loaded modules :

 nicolas.greneche@magi3:~$ module list
 Currently Loaded Modulefiles:
  1) /softs/modules/slurm/21.08.5   2) /softs/modules/compiled/gcc/10.2.1/openmpi/4.1.2

To see all available modules :

 nicolas.greneche@magi3:~$ module av
 ------------------------------------------- /softs/modules/slurm -------------------------------
 ------------------------------------------- /softs/modules/compiled ----------------------------

And to unload a module :

 nicolas.greneche@magi3:~$ module unload /softs/modules/compiled/gcc/10.2.1/openmpi/4.1.2

The module is unloaded :

 nicolas.greneche@magi3:~$ module list
 Currently Loaded Modulefiles:
  1) /softs/modules/slurm/21.08.5

Upgrade from lmod to environment modules

You should modify your .bashrc to switch from lmod to environement modules. The .bashrc is located at the root of your home directory. For example, my .bashrc is in /home/dist/nicolas.greneche/.bashrc. For lmod you may find a section that looks like this :

 if [ -z "$BASHRC_READ" ]; then
    export BASHRC_READ=1
    module use /softs/modulefiles/Compiler
    module use /softs/modulefiles/Core
    module use /softs/modulefiles/MPI
    #Eventually, custom modules

You should replace this section with this one below :

 if [ -f /etc/profile.d/ ]
    source /etc/profile.d/
    export MODULEPATH=/softs/modules/slurm:/softs/modules/compiled:/softs/modules/intel:/softs/modules/packages
    # Enable some modules here
    module load /softs/modules/slurm/default

Then, you disconnect and reconnect to Magi and you should use environment modules.

modules.txt · Last modified: 2022/03/23 11:47 by nico