You are here: Home / Cluster / Cluster Tools / Modules

Modules

Setting environment variables is a hassle. Many programs require a whole collection of environment variables to be set, which is a further hassle. You could script this in your .bashrc file on a per-person basis. But what if we need several different versions of the same program (e.g. a compiler, or important library) installed on the same computer, and use different versions at different times? Suddenly your simple script gets more complicated…

The Modules program allows sets of environment variables to be added or removed in a single command. You can also have sets of variables that require other sets to be loaded first. (For example, in order to use the Intel version of the OpenMPI library, you must first load the environment variables for the Intel compiler.)

On the cluster, many existing modules are defined for common compilers, MPI libraries, data handling programs, etc. No modules are loaded by default, so often you will need to explicitly load a module in order to do something useful.

Just like environment variables, modules only affect the current terminal window, and are reset the next time you log in.

module avail - Print available modules on system

module avail

module display - Print information on specific module

module display <<name>>

# Example:  Show environment variables set by openmpi module
module display mpi/openmpi-1.8.8

module list - Print currently loaded modules

module list

module load - Activate a module (i.e. SET the environment variables)

module load <<name>>

# Example: Load version 1.8.8 of OpenMPI
module load mpi/openmpi-1.8.8

module unload - Deactivate a module (i.e. REMOVE the environment variables)

module unload <<name>>

# Example: Unload version 1.8.8 of OpenMPI
module unload mpi/openmpi-1.8.8