On the cluster, the so-called module environment system LMod version 8.2.4 is installed. Modules enable users to change environments (see Linux basics) quickly. For example, if a software is installed in multiple versions, the command to run the software would be ambiguous. In these cases, you can select which version you want by loading the corresponding module.
When you log in, some modules are loaded automatically, some need to be loaded by hand for their commands to be available. Others are loaded automatically when you load a module that depends on them.
Each module is defined in a separate module file.
Using the module system
LMod uses a number of commands, all of which start with the word
To display available modules type
$ module avail ---------------------------- /opt/ohpc/pub/moduledeps/gnu9 ----------------------------- R/3.6.3 mpich/3.3.2-ofi gsl/2.6 mvapich2/2.3.2 hdf5/1.10.6 openblas/0.3.7 impi/2019.5 openmpi4/4.0.4 (L) impi/2019.5.100010_cm9.0_6a80743563 pdtoolkit/3.25.1 impi/2020.1 plasma/2.8.0 impi/2020.1.100005_cm9.0_8629b716ff (D) ----------------------------- /cm/shared/ohpc/modulefiles ------------------------------ cmake/3.16.2 os gnu9/9.3.0 (L) papi/5.7.0 intel/19.0.5_2019 paraver/4.8.2 intel/18.104.22.168010_cm9.0_6a80743563 prun/2.0 intel/19.1.1_2020 singularity/3.4.2 intel/22.214.171.124005_cm9.0_8629b716ff (D) ucx/1.8.0 (L) libfabric/1.10.1 (L) valgrind/3.15.0
Loaded modules are marked with
(L), default modules with
(D). As you can see, there is a hierarchy of names, whose levels are separated by slashes like directory paths. For example,
module load impi/2019.5 would load a specific version of the Intel MPI software, while
module load impi would load the preset default (
impi/impi/2020.1.100005_cm9.0_8629b716ff in this case).
Note also that they are grouped by paths in the
MODULEPATH environment variable.
MODULEPATH determines where groups of module files are.
Not all modules are always displayed with
module avail, because some modules depend on others. With the command
module spider <module name>
you can search for modules.
The most important command is the one for loading and unloading modules:
$ module load <module name> $ module unload <module name>
Loaded modules can be displayed with
$ module list
All modules can be unloaded with the following command (this is often useful for debugging):
There are some additional commands that can be shown with:
Although you will typically use module files provided by ZIMT, in principle you can write your own module files. To do that you have to do two things: first, you need to write the module file and second, you need to add the path to the module file to
A module file in LMod is a script that is written in the Lua language. It needs to end in
.lua. It defines which actions are to be performed when the module is loaded. Predefined Lua functions exist for these actions. As an example, the
dot module file is shown.
dot is a module on the cluster which adds the current directory (
.) to the PATH (see also Linux basics).
whatis("adds `.' to your PATH environment variable ") append_path("PATH",".") help([[ Adds `.' to your PATH environment variable This makes it easy to add the current working directory to your PATH environment variable. This allows you to run executables in your current working directory without prepending ./ to the excutable name Version 3.2.10 ]])
append_path() does the actual appending, the functions
whatis() serve to provide users with information about the module. Here is a list with possible functions in LMod.
You can display the contents of an existing module file with
module show <module name>.
Adding to MODULEPATH
To add a path to an environment variable, you need to re-export the variable:
$ export MODULEPATH=$MODULEPATH:/home/demo_user/exampledir
More details are on the Linux basics page. That page also shows how to make this setting permanent by adding it to
Caution: Changing environment variables, especially permanent changes, can lead to commands in Linux not functioning any more. You should exercise maximum caution when doing it. You can test changes to environment variables by entering them manually in the console. Then you can restore the previous settings by logging out and logging back in.