Modules - a tool for setting up

The Modules software package can dynamically switch and configure the environment settings required to use the compiler, library, and application by executing the module command. The module command allows you to easily change environment settings for each different versions of compilers, libraries, and applications.

Command Purpose
module list Display all loaded module files.
module avail Display all available module files.
module show [module_file_name] Display the module file settings.
module load [module_file_name] Load the module files.
module unload [module_file_name] Unload the module files.
module switch [module_file_name1] [module_file_name2] Switch the module files. (module_file_name1→module_file_name2)

Module load / unload / switch errors may occur due to dependencies between module files. If you are aware of the possibility of errors in dependencies, you can force module files to load or switch by using -f option.

## Status immediately after login
$ module list
Currently Loaded Modulefiles:
 1) slurm/2022   2) SysB/2022   3) intel/2022.3(default)   4) intelmpi/2022.3(default)   5) PrgEnvIntel/2022(default)

## When trying to switch intel compiler to 2018.4, error occurs.
$ module switch intel/2018.4
Unloading intel/2022.3
  ERROR: intel/2022.3 cannot be unloaded due to a prereq.
    HINT: Might try "module unload PrgEnvIntel/2022" first.

Switching from intel/2022.3 to intel/2018.4
  ERROR: Unload of switched-off intel/2022.3 failed

 using 
## Forced switching using -f option
$ module switch intel/2018.4 -f
Unloading intel/2022.3
  WARNING: Dependent 'PrgEnvIntel/2022' is loaded

## Status after change
$ module list
Currently Loaded Modulefiles:
 1) slurm/2022   2) SysB/2022   3) intelmpi/2022.3(default)   4) PrgEnvIntel/2022(default)   5) intel/2018.4

We provide following three types of comprehensive modules file sets for each programming environment. These module files provide initial settings for the compiler environment and the MPI environment.

  • Intel programming environment (standard environment for system A/B/C/D/E) : PrgEnvIntel
  • NVIDIA HPC SDK programming environment (standard environment for system G) : PrgEnvNvidia
  • GNU programming environment : PrgEnvGCC

Please use module list command to check the current module environment.

$ module list
Currently Loaded Modulefiles:
  1) XXX 

The system is the main compiler environment when logging in. An example of switching programming environments is provided below.

Example: Switching from an Intel environment to an NVIDIA environment

$ module switch PrgEnvIntel PrgEnvNvidia

If multiple versions are available, you can switch the compiler version to be used. The following is an example of how to operate for the intel compiler.

Example: Switching between prepared programming environments

$ module switch PrgEnvIntel/2022 PrgEnvIntel/2018

Example: When you load another version of the Intel compiler additionally (the later loaded version takes priority)

$ module load intel/Y.Y 

Example: When you switch Intel compiler versions individually (-f is required)

$ module switch intel/X.X intel/Y.Y -f 

The description of the currently loaded version (intel/X.X in the above example) can be omitted.

$ module switch intel/Y.Y -f

Example of using MATLAB

Execute the module command to make a environment settings. (Load the module files of any version you want.)

$ module load matlab/R2020b

It will be able to execute MATLAB startup commands.

$ matlab

Switching the version of MATLAB(R2020b→R2021a)

Execute the module command to change a environment settings.

$ module unload matlab/R2020b
$ module load matlab/R2021a
または
$ module switch matlab/R2021a

For how to use the modules with other applications, please refer to Available Software.

You can create and use your own module files for your convenience. For details on how to create a module file, please refer to man page. To use your customized module file, specify the directory where your module file is stored to the module use command and add the path. To delete the previously-added path, execute the module unuse command. You can check the path of module files using the environment variable MODULEPATH.

Example: Checking the path of module files

## Make the created module file available (for user of x12345)
$ module use /home/x/x12345/mymodule

## Check the path of the module file
$ echo $MODULEPATH
/home/x/x12345/mymodule:/opt/app/modulefiles/common:
/opt/system/app/env/intel/isv:
/opt/system/app/env/intel/oss:

## Delete the path you added
$ module unuse /home/x/x12345/mymodule

## Make the created module file available with a lower priority than the original path
$ module use -a /home/x/x12345/mymodule

## Check the path of the module file
$ echo $MODULEPATH
/opt/app/modulefiles/common:/opt/system/app/env/intel/isv:
/opt/system/app/env/intel/oss:
/home/x/x12345/mymodule:

Example: Adding and using a module file

## Check the created module file
$ ls -F /home/x/x12345/mymodule
ruby/
$ ls -F /home/x/x12345/mymodule/ruby
1.8.7  1.9.3  2.1.2

## Make the created module file available
$ module use /home/x/x12345/mymodule

## Check that the created module file is displayed
$ module avail
--------------------------- /home/x/x12345/mymodule/ ---------------------------
ruby/1.8.7 ruby/1.9.3 ruby/2.1.2
------------------------- /opt/system/app/intel/ --------------------------
PrgEnvIntel/2022          intel/2022.3
(Omitted)

## Load the created module file
$ module load ruby/2.1.2e

Welcome to the Environment Modules Project
Man page of Modulefile