Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Behaviour change: Lmod does the right thing

If you have used modules before, you will see the commands and options are almost identical. You will be able to load and unload modules, as well as checking which ones are loaded or available to load.

Please have a look at the Lmod modules command reference list for details on the different subcommands.

However, there are some changes in the behaviour in respect to the Traditional TCL modules that you may appreciate:

Return codes

If the command fails for any reason (i.e. the module does not exist), it will return a non-zero exit code so you can trap it and deal with it appropriately. There is no need to check wether the module has been loaded or not. You may find that some scripts may fail early where they were not failing before because of this new behaviour

No Format
$ module load git; echo return_code=$?
load git 2.20.1 (git_DIR, GIT_VERSION, PATH)
return_code=0
$ module load foo; echo return_code=$?
Lmod has detected the following error:  The following module(s) are unknown: "foo"

Please check the spelling or version number. Also try "module spider ..."
It is also possible your cache file is out-of-date; it may help to try:
  $ module --ignore-cache load "foo"

Also make sure that all modulefiles written in TCL start with the string #%Module

return_code=1

Load and swap

Loading a module when there was another version of it loaded is no longer a problem. Lmod will swap them automatically.

No Format
$ module load git
load git 2.20.1 (git_DIR, GIT_VERSION, PATH)
usxa@at1-11: ~ [2020-03-18 16:03:57 UTC] [0] 
$ module load git/new
unload git 2.20.1 (git_DIR, GIT_VERSION, PATH)
load git 2.25.1 (git_DIR, GIT_VERSION, PATH)

The following have been reloaded with a version change:
  1) git/2.20.1 => git/2.25.1

Automatic version aliases

If you try to load a module with an incomplete version, it will try and find the best (latest) version that matches instead of failing.

No Format
$ module avail git

-------------------------------------------------------------------------------------- Global Aliases ---------------------------------------------------------------------------------------
   pa -> prgenv/amd    pe -> prgenv/expert    pg -> prgenv/gnu    pi -> prgenv/intel    pp -> prgenv/pgi

--------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/core ---------------------------------------------------------------------------
   git/2.20.1 (D)    git/2.25.1 (new)

  Where:
   Aliases:  Aliases exist: foo/1.2.3 (1.2) means that "module load foo/1.2" will load foo/1.2.3
   D:        Default Module

Use "module spider" to find all possible modules and extensions.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

$ module load git/2
load git 2.20.1 (git_DIR, GIT_VERSION, PATH)
$ module load git/2.25
unload git 2.20.1 (git_DIR, GIT_VERSION, PATH)
load git 2.25.1 (git_DIR, GIT_VERSION, PATH)

The following have been reloaded with a version change:
  1) git/2.20.1 => git/2.25.1

Conflict management

If two modules cannot be loaded at the same time due to a conflict, the old one will be swapped out and the new one will be loaded automatically.

No Format
usxa@at1-11: ~ [2020-03-18 16:06:12 UTC] [0] 
$ module load proj4
load proj4 5.2.0 (PROJ4_DIR, PROJ4_VERSION, PROJ4_INCLUDE, PROJ4_LIB, PATH, MANPATH)
usxa@at1-11: ~ [2020-03-18 16:06:29 UTC] [0] 
$ module load proj
load proj 6.1.1 (PROJ_DIR, PROJ_VERSION, PROJ_INCLUDE, PROJ_LIB, PATH, MANPATH)

Lmod is automatically replacing "proj4/5.2.0" with "proj/6.1.1".

unload proj4 5.2.0 (PROJ4_DIR, PROJ4_VERSION, PROJ4_INCLUDE, PROJ4_LIB, PATH, MANPATH)
unload proj 6.1.1 (PROJ_DIR, PROJ_VERSION, PROJ_INCLUDE, PROJ_LIB, PATH, MANPATH)
load proj 6.1.1 (PROJ_DIR, PROJ_VERSION, PROJ_INCLUDE, PROJ_LIB, PATH, MANPATH)

Native flavour support

You may feel that some packages or versions are missing when running the classic module avail. Lmod knows about those packages that are flavoured for different environments (compilers or MPI), and will only show as available to load those that have been installed for the currently loaded environment. This guarantees that when loading a module the right flavour of the tool or library will be used, avoiding incompatibilities.

Use module spider to see the whole picture.

The

...

If you have used modules before, you will see the commands and options are almost identical. You will be able to load and unload modules, as well as checking which ones are loaded or available to load.

Please have a look at the Lmod modules command reference list for details on the different subcommands.

The ECMWF setup

...

prgenv module

Info

See the whole description for this in the prgenv module

Different compilers families and versions are provided, and with them many different flavours of a given package and versions may be available. Loading the right one matching the current setup avoiding incompatibilities with other packages becomes a complex task.

The prgenv module addresses this problem. There is a prgenv for each compiler family, so it can guarantee a minimal compatibility between different packages.

No Format
$ module avail prgenv

-------------------------------------------------------------------------------------- Global Aliases ---------------------------------------------------------------------------------------
   pa -> prgenv/amd    pe -> prgenv/expert    pg -> prgenv/gnu    pi -> prgenv/intel    pp -> prgenv/pgi

------------------------------------------------------------------------- /usr/local/apps/modulefiles/lmod/prgenvs --------------------------------------------------------------------------
   prgenv/amd (a)    prgenv/expert (E,e)    prgenv/gnu (D:g)    prgenv/intel (i)    prgenv/pgi

The ECMWF setup: things to remember

Here are a few considerations regarding the setup at ECMWF:

  • No modules are loaded by default. You should load what you need when you need it.
  • You may need to load a prgenv, and optionally an MPI implementation, to be able to see a more complete list of modules to load.
  • Use module spider if you can't find a module. If it exists, it will tell you how to load it.