Skip to content

Environment Modules

The environment modules system simplifies the use of applications and supporting libraries that may come in different versions and revisions. The software modules provide a way to easily switch between e.g. multiple revisions of the same application, where one revision may provide a set of functionality not available in another revision.

The core command by which software modules can be listed, loaded (activated), and unloaded (deactivated) is module, followed by an appropriate command.

The modules work by setting specific environment variables needed for the respective software program when the software module corresponding to the application is loaded. Often, this is simply adding the program to the $PATH variable, but software containing libraries and headers will also set $LD_LIBRARY_PATH. Any other variable that the software may need can be set and so the contents of the modules can be fairly simple or complex.

There are several advantages to using software modules to set up your environment, especially on a supercomputer:

  • ease of use
  • ability to revert to your previous environment
  • ability to easily switch your environment to try different versions of a program
    • e.g. when single and double-precision versions of the program exist
    • e.g. when a program has been compiled with different features that cannot coexist in a single build of the program
    • e.g. when a program has been compiled with different compilers or MPI suites

Using modules

The module command is only available on compute nodes and not on the login nodes. The applications provided through the software modules system must be used only on compute nodes.

ModuleGIF

Using environment modules

  • Finding applications: module avail

To lists all available (loadable) modules and module groups. With the information of these two commands:

module avail
  • Listing loaded application profiles: module list

To get a list of all currently loaded modules:

module list
  • Loading or unloading application profiles: module load/unload

To load a specific module

module load <module_name>

Default version

In case of multiple software versions, one version will always be defined as the default version, and can be identified by its (D) mark in the module avail output. When loading a software module, if the version is not specified, the default is loaded (e.g. module load FFTW will activate FFTW/3.3.8-gompic-2020b if this is the default). Fully specifying the software module (name+version) should always be preferred to ensure that the correct version is being activated.

Unloading an environment module will undo the changes that module made to the environment, restoring any variables set to their previous values. To unload a specific module you can use the following:

module unload <module_name>
  • Unloading all profiles: module purge
module purge
  • Switching profiles: module switch

To swap a specific module for another one (especially useful to switch between different versions of the same program) use the following:

module switch <old_module_name> <new_module_name>

Module Commands

MeluXina uses the Lmod software modules system, the table below summarizes the most common module commands:

Module Command Description
module avail List/browse available modules
module list Show modules currently loaded (active)
module load module_name Load a specific module (may load additional modules as dependencies)
module unload module_name Unload a loaded module (does not unload modules activated as dependencies)
module swap module_name1 module_name2 Unload module_name1 and load module_name2
module purge Unload all loaded modules
module reset Reset loaded modules to system defaults
module show module_name Display the contents of a selected module
module spider List all modules and the short description of each
module spider package Display the description and various versions available of an application
module use path Prepend the path to the MODULEPATH search path. Use -a to append to the path
module save name Save the current list of modules to "name" collection
module restore name Restore modules from "name" collection