Lmod: A software configuration manager

Several versions of software may also need to be provided on the same system. Some software depends on other software; that is, will only run if some other software is also available. Environment variables often need to be set to properly configure software.

Lmod is a software package that is used to manage which other software packages are available and properly configure them. The Lmod package provides the module command, which what you will use to access most software installed on the cluster.

Using Lmod

Loading a software package’s module will set up the environment variables needed for that package to run.

Unloading a software package’s module remove the environment variables that were added for the package.

Loading software

When you know the name of the software module you wish to load, say, stata, then you load it with the following command (the $ is the prompt; do not type it).

$ module load stata

Loading software will add any needed configuration to your environment so the software can be used. Software comes in different versions, and versions are added to the module name with a slash, as in this example which loads version 15 of the Stata module.

$ module load stata/15

A specific version of a module is always loaded, and you can see which modules/versions are loaded with

$ module list
Currently Loaded Modules:
  1) stata/15

Finding software

To load software, you must know the name of the module. The following sections illustrate ways to find software for which modules exist. The illustrations proceed from the most general to the most specific.

Each software module contains the module name, which is often the name of the package, a description of the software package, and a list of categories into which the installer of the software thinks the software falls. The search commands search different combinations of these.

Searching for software by keyword

The most general way to search for software, as you might wish to do when you don’t know the exact software name but do have some possible words that might describe its general use. Using a keyword search is the most general. That will search for the given term in the name, description, and categories of all modules. For example, searching for software that has statistics in all of the module descriptive field mentioned above is shown in the following example. The output shows that three software modules contain statistics in their description, category, or name: R, sas, and stata.

$ module keyword statistics
The following modules match your search criteria: "statistics"
  R: R/3.3.0, R/3.3.2, R/3.3.3, R/3.4.1, R/3.4.2
    R environment for statistical computing and graphics
  sas: sas/9.4-TS1M4, sas/9.4
    SAS statistical system software.
  stata: stata/14, stata/15
    Statistical analysis software.
To learn more about a package execute:
   $ module spider Foo
where "Foo" is the name of a module.

To find detailed information about a particular package you
must specify the version if there is more than one version:
   $ module spider Foo/11.1

This search will give you names of modules about the command to find more information about them.

Searching by name

To search for all installed software by module name, regardless whether it is currently available or not, you should use the spider subcommand. The following example shows the output from searching for fftw, which shows version 3.3.7 is installed and that the module fftw-mpi is a ‘near miss’.

$ module spider fftw
      Libraries for computation of discrete Fourier transform.

     Other possible modules matches:
  To find other possible module matches execute:
      $ module -r spider '.*fftw.*'
  For detailed information about a specific "fftw" module (including how
  to load the modules) use the module's full name.
  For example:
     $ module spider fftw/3.3.7

Note that wildcard matches use the .* to match zero or more characters, not a plain * character.

The last line shows you the command to run to find out how you can load fftw. Running that command shows the following command.

$ module spider fftw/3.3.7
  fftw: fftw/3.3.7
      Libraries for computation of discrete Fourier transform.

    You will need to load all module(s) on any one of the lines below before the "fftw/3.3.7" module is available to load.


From that, you will see that you must load one of the modules gcc/4.8.5 or intel/18.0.0 first, after which the fftw software that matches the loaded compiler will then be available to load.

Available software

Software that is compiled and built here, as opposed to software that is purchased from a company, often depends on other software to run. For example, software that requires that the compiler module with which it was built be loaded for it to run properly. Software that requires a specific compiler is said to belong to a compiler family, and its module(s) will only be available to load once the compiler is loaded.

Here we show an abbreviated list of what is available with no compiler loaded.

$ module available
------------------ Core applications including compilers -------------------
   R/default (D)    gcc/4.8.5         matlab/R2017b        stata/14
   R/3.4.1          intel/18.0.0      sas/9.4-TS1M4 (D)    stata/15 (D)
   R/3.4.2          launcher/3.1.1    sas/9.4

Any module listed above is available to be loaded without loading anything first. Software compiled with, say, the GCC, version 4.8.5, compiler is not listed. Loading the gcc/4.8.5 module will make additional software available, as shown below.

$ module load gcc/4.8.5
$ module available
------------------- Applications compiled with GCC 4.8.5 -------------------
   fftw/3.3.7     impi/2018.0.128    ompi/1.10.7        szip/2.1.1
   hdf5/1.8.20    netcdf/4.6.0       ompi/3.0.0  (D)

------------------ Core applications including compilers -------------------
   R/default (D)    gcc/4.8.5      (L)    matlab/R2017b        stata/14
   R/3.4.1          intel/18.0.0          sas/9.4-TS1M4 (D)    stata/15 (D)
   R/3.4.2          launcher/3.1.1        sas/9.4

Prior to loading the gcc/4.8.5 module (or some other compiler for which fftw has been compiled), it was not considered available for loading.

You can combine a prerequisite on the same load command as the package you want, as in

$ module load gcc/4.8.5 fftw

If you do not specify the version number for a module, as is the case for the fftw module in the last example, the default version (or the numerically largest) will be loaded.