Use modules to manage your software environment on IU research supercomputers

On this page:


Carbonate uses the Modules module management system; Big Red 200 and Quartz use the Lmod module management system.

Each module contains commands for handling dependencies and setting environment variables (for example, PATH, LD_LIBRARY_PATH, and MANPATH) that are needed to run a particular application (or a particular version of an application) in your user environment. You can load and unload modules to automatically modify environment variables as needed when switching between software packages.

Commands that are common between Modules and Lmod

Modules and Lmod share some common commands; for example:

Command Action
module avail List all software packages available on the system.
module avail package List all versions of package available on the system; for example, module avail python.
module list List all packages currently added to your user environment.
module load package Add the default version of the package to your user environment; for example, module load intel.
module load package/version Add the specified version of the package to your user environment; for example, module load intel/18.0.2.
module unload package Remove the specified package from your user environment.
module swap package_A package_B Swap the loaded package (package_A) with another package (package_B). This is synonymous with module switch package_A package_B.
module show package Show the changes, such as environment variables set and library paths added, that loading the specified module (package) makes to your user environment. This is synonymous with module display package.

For more about the module command in Modules, see its manual page.

For more about the module command in Lmod, see User Guide for Lmod.

About module hierarchies in Lmod

Although Modules and Lmod are similar in some respects, there are differences between them. One significant difference is Lmod's use of module hierarchies. When you invoke module avail in Lmod, it will by default show only those modules that are compatible with the modules that are currently loaded in your environment.

For example, on Quartz, GNU is the default compiler environment. If you run module avail, Lmod will list only GNU-compatible modules and modules that don't have any compatibility or dependency characteristics. To find modules that depend on MVAPICH, you first must load a MVAPICH module.

To search for all modules that are available, regardless of compatibility, use the Lmod module spider command, which lists all the modules available on the system. To search for a specific module (package), use module spider package.

Make permanent changes to your user environment

Using Modules or Lmod, you can save your customized user environment so that it loads every time you start a new session.

In Modules

Whenever you open a new shell, Modules looks for a .modules file in your home directory and executes any module commands it finds there.

For example, if the Intel 13 and GCC 4.7 compilers are always wanted, but the Open MPI libraries might be either GNU or Intel, a typical .modules file might look like this:

module load core
module load gcc/4.7.2
module load intel/13.0.1
module load openmpi/intel/1.6.3
# openmpi/gnu/1.6.3
module load fftw/intel/3.3.3

Placing a # at the start of a line makes the entire line inactive.

To change between the modules, simply edit and source the file.

In Lmod

In Lmod, you can create a custom set of modules that are loaded every time at login, as follows:

  1. Load the modules that you want as part of the default group, and remove any modules that are not needed.
  2. Run the command module save.
  3. Run the command module list.

This exact set of modules will now be loaded by default at login. To change this in the future, add or remove modules to the environment and run module save to create a new default set of modules.

For additional options and possibilities, see the "User Collections" section of the User Guide for Lmod.

This is document bcwy in the Knowledge Base.
Last modified on 2023-11-20 09:19:14.