Environment modules¶
Our clusters use Lmod to manage software packages, libraries, and compilers. Modules allow you to dynamically load and unload software in your shell session, avoiding version conflicts and keeping your environment clean.
Quick reference¶
| Command | Description |
|---|---|
module avail |
List all available modules |
module spider <name> |
Search for a module and show its dependencies |
module load <name> |
Load a module |
module unload <name> |
Unload a module |
module list |
List currently loaded modules |
module purge |
Unload all modules |
module display <name> |
Show what a module does (paths, variables, etc.) |
module help <name> |
Show help information for a module |
module use <path> |
Add a custom directory to the module search path |
module --show-hidden avail |
Include hidden modules in the listing |
Finding software¶
Use module avail to browse all available software:
module avail
If you know the name (or part of it), use module spider to search:
module spider FFTW
module spider is especially useful because it also shows which dependencies need to be loaded first. If a module you expect to find is not listed, try including hidden modules:
module --show-hidden spider libGLU
Loading and unloading modules¶
Load one or more modules:
module load QuantumESPRESSO/6.8-intel-2021a
Check what is currently loaded:
module list
Unload a specific module:
module unload QuantumESPRESSO/6.8-intel-2021a
Unload everything and start fresh:
module purge
Tip
Only load the modules you need for a given task. Loading unnecessary modules increases the chance of version conflicts. Use module purge between different workflows to start from a clean state.
Understanding module names¶
Modules follow the naming convention name/version-toolchain-toolchainversion. For example:
QuantumESPRESSO/6.8-intel-2021a
│ │ │ │
│ │ │ └─ Toolchain version (first half of 2021)
│ │ └──────── Toolchain (Intel compilers + MPI + MKL)
│ └──────────── Software version
└───────────────────────────── Software name
The toolchain tells you which compilers and libraries were used to build the software.
Warning
Modules built with different toolchains may not be compatible with each other. Avoid mixing toolchains (e.g. foss and intel) in the same session, this is one of the most common causes of unexpected errors and crashes.
Toolchains¶
Our software is built with two main toolchains:
| Toolchain | Components |
|---|---|
| foss | GCC, OpenMPI, OpenBLAS, LAPACK, ScaLAPACK, FFTW |
| intel | Intel compilers, Intel MPI, Intel MKL |
Each main toolchain has subtoolchains that contain a subset of its components:
| Subtoolchain | Part of | Components |
|---|---|---|
gompi |
foss |
GCC, OpenMPI |
GCC |
foss |
GCC compilers only |
gfbf |
foss |
GCC, FlexiBLAS, FFTW |
iimpi |
intel |
Intel compilers, Intel MPI |
GCCcore |
Both | GCC compilers (base for all) |
Modules built with subtoolchains of the same main toolchain are generally compatible. For example, a module built with gompi/2020b is compatible with one built with foss/2020b, because gompi is a subset of foss. However, mixing foss and intel toolchain modules will likely cause conflicts.
How to choose
Check which toolchain is available for the software you need using module spider. If both are available, either will work well. Consistency matters more than the choice itself; avoid mixing foss and intel modules in the same session.
Inspecting a module¶
To see exactly what a module does to your environment before loading it:
module display QuantumESPRESSO/6.8-intel-2021a
This shows which paths are added to PATH and LD_LIBRARY_PATH, which dependencies are loaded automatically, and any environment variables that are set. This is useful for debugging issues where a program cannot find a library or executable.
Using custom modules¶
If you have installed software in your home directory or want to maintain project-specific modules, you can add your own module directory:
module use /dipc/username/my_modules
After this, module avail will also list modules from that directory. This change only applies to your current session. To make it permanent, add the command to your ~/.bashrc.