Skip to content

The Modules System

Introduction

The Modules system organizes the multitude of packages we have installed on our clusters so that they can be easily maintained and used. More specifically, Modules configure appropriately the execution environment of each software package and version.
Most non-OS software is organized by the Modules system. This includes all compilers and associated libraries. Each package has a corresponding modulefile or simply a module where the appropriate actions are specified (in a prescribed format) in setting up its execution environment.
Notify the help desk if you cannot locate the module appropriate for an application.

Module Commands

To find out what software packages are available under the Modules system use one of the following two commands to search for a package named packageName:

[username@cluster ~]$ module spider packageName

On clusters that have a module hierarchy system (ACES, FASTER, Grace), use spider with the full module name (case sensitive) to see what dependencies need to be loaded first.

[username@cluster ~]$ module spider packageName/version

After loading a specific packageName/version hierarchy module, see what other modules are available for the currently loaded modules

[username@cluster ~]$ module avail

In order to use some software on our clusters, the module for the software must be loaded first. To load the module for a software package, use the following command including any module hierarchy dependencies that are described in the module spider packageName/version output:

[username@cluster ~]$ module load packageName/version
  • The specification of packageName/version in the load command is case sensitive and it must include a specific version. No packages are preloaded by default.
  • Loading a package is required in order to use the software and access the man pages associated with the package if they are available.

To find out what packages/modules you have loaded on your current session, use the following command:

[username@cluster ~]$ module list

To remove ALL modules from your current session, use the following command:

[username@cluster ~]$ module purge

To remove one module from your current session, use the following command:

[username@cluster ~]$ module unload packageName

Note: It is very important to remove all modules when switching between software and compilers. Mixing modules and versions is NOT a good idea and can cause many problems.
To search and list what packages/modules are available on the cluster, enter any suitable combination of the following:

  • List all versions for packageName.
[ username@cluster ~]$ module spider packageName
  • List detailed information about a particular version of packageName
[ username@cluster ~]$ module spider packageName/version
  • List all modules with a short description that contain the text string
[ username@cluster ~]$ module keyword string
  • Lists all the subcommands under the module command.
[ username@cluster ~]$ module help
  • Lists information about packageName
[ username@cluster ~]$ module help packageName

HPRC Shorthand

A handy front end for the HPRC module system is the command: ml

Note: The abbreviation ml can be used instead of module, module load, or module list depending on the situation. This can be seen in the examples below.

  • list currently loaded modules
[ username@cluster ~]$ ml
  • search for available modules
[ username@cluster ~]$ mla packageName
  • see if any dependency modules need to be loaded with packageName module
[ username@cluster ~]$ ml spider packageName
  • load module named packageName/version
[ username@cluster ~]$ ml packageName/version
  • module subcommand where subcommand can be: avail, save, restore, show
[ username@cluster ~]$ ml subcommand arg1 arg2 

An additional shorthand command provided is: mla which replicates the function of module avail, but stores results in a file for quick reference later.

  • same as module avail packageName
[ username@cluster ~]$ mla packageName
  • the module listing for installed software is cached for each user. To see recently installed software you may have to update your cached copy
[ username@cluster ~]$ mla -f

Examples

  • The output below shows the output of the ml spider command for ABAQUS
[ username@cluster ~]$ ml spider ABAQUS
----------------------------------------------------------------------------------------
  ABAQUS:
----------------------------------------------------------------------------------------
    Description:
      Finite Element Analysis software for modeling, visualization and best-in-class
      implicit and explicit dynamics FEA. - Homepage:
      `<http://www.simulia.com/products/abaqus_fea.html> 

     Versions:
        ABAQUS/6.12.1-linux-x86_64
        ABAQUS/6.13.5-linux-x86_64
   . . .

  • The output below illustrates the fact that a modulefile's complete name includes its version. An installed application can have several versions.
[ username@cluster ~]$ ml ABAQUS/2017
[ username@cluster ~]$ ml

Currently Loaded Modules:
  1) ABAQUS/2017`

WARNING: Do not include module commands in your startup files!!!

We advise users to NOT put module load commands in their startup files like $HOME/.bashrc and $HOME/.bash_profile. Although you may think this makes life easier you will find in time that it causes all kinds of problems later on (e.g. when switching to different programs or running batch jobs).

If you really want to be able to load a set of modules quickly then look at Lmod's "user collections". You can use module save to create a default collection of modules and then you simply have to run module restore to restore them (BUT DON'T DO THAT in .bashrc/.bash_profile). You can also name collections... e.g. I might do module save openfoam after loading all the OpenFOAM modules I need (after a module purge). Then I can restore my collection with module restore openfoam

Back to top