On the cluster, the so-called module environment system LMod version 7.7 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 ---------------------------- /cm/shared/modulefiles ---------------------------- DefaultModules (L) PrgEnv/gcc-openmpi/6.3.0-1.10.3 PrgEnv/intel-openmpi/17.0.5-1.10.3 (L) abaqus/6.13-2 abaqus/2017 abaqus/2018 (D) ----------------------- /cm/shared/ohpc/pub/modulefiles ------------------------ EasyBuild/3.6.1 gnu7/7.3.0 (D) papi/5.6.0 (D) autotools intel/22.214.171.124 prun/1.2
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 abaqus/2017 would load a specific version of the Abaqus software, while
module load abaqus would load the preset default (
abaqus/2018 in this case).
Note also that they are grouped by paths in the
MODULEPATH environment variable.
MODULEPATH determines where groups of module files are.
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
There are some additional commands that can be shown with
Defining custom modules
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.