How to use environment modules
Environment modules are a convenient and efficient way to use non-standard and version-specific software in Unity. The following guide shows you how to enable and disable modules, view all currently active modules, search for modules, and unload all active modules.
List all available modules
To list all available modules, use any of the four commands listed below:
module available
module avail
module av
ml av
The module available
command outputs a partial list of the modules available in Unity. However, this command does not show modules that require loading an intermediate module, such as those arranged in a module hierarchy. To see a full list of modules, use the module spider
command described in the next section.
---------------------------- /modules/modulefiles/x86_64 -----------------------------
AF_Cluster/2023-05-01 libiconv/1.17
BBMap/38.90 libtool/2.4.6
EcoAssist/4.4.0 mathematica/12.0
GeneMarkS-T/3.20 mathematica/12.2.0
module spider
command in your terminal.Search for modules
To search for specific software, use the module spider
command followed by the software you are searching for. In the following example, module spider raxml
finds all versions of the raxml
module:
module spider raxml
The output may list several versions. Run the command again with a specific version for more information.
module spider raxml/8.2.11
The output may tell you that you need to load another module first, due to the Module Hierarchy.
You will need to load all module(s) on any one of the lines below before the “raxml/8.2.11” module is available to load.
intel-oneapi-mpi/2021.6.0
In this case, you can load them together as in:
module load intel-oneapi-mpi/2021.6.0 raxml/8.2.11
Load modules
To load a module, use the module load
command followed by the module of choice. In the following example, module load gcc/9.2.0
loads the module gcc/9.2.0
:
module load gcc/9.2.0
Unload modules
To unload modules, use the module unload
command followed by the module(s) of choice. In the following example, module unload gcc
unloads all gcc
modules:
module unload gcc
This is only necessary in an interactive session if you are switching modules, or in a batch script between programs using incompatible modules, although even there module purge
may be better.
Unload all active modules
To unload all active modules, use the following command:
module purge
The module purge
command quickly unloads all currently active modules. Purging modules is the best practice ahead of loading any modules in your batch scripts since it will ensure your job doesn’t inherit any unexpected modules from your login session.
List currently loaded modules
To list the modules that are currently loaded, use the following command:
module list
Note that the commands module list
and module avail
are distinct. While module avail
lists available modules, including modules you haven’t loaded, module list
shows all modules that are currently loaded and affecting your compute session.