Accounts High Performance Computing Systems Visualization Facilities Software
Systems System Utilities File Transfer Remote Connectivity Remote Display

Environment Modules User Guide

Environment Modules is a framework to manage what software is loaded into a user's environment. Its functionality includes the ability to list all software packages currently available in the Environment Modules system, list all software packages loaded into a user's environment, load a new software package into a user's environment, and unload a software package from a user's environment.

Listing All Available Packages

The command to list all available packages is module avail.

[abc123@lionxi ~]$ module avail

------------------------ /usr/global//Modules/versions -------------------------
3.2.6

-------------------- /usr/global//Modules/3.2.6/modulefiles --------------------
GraphicsMagick/1.3.7 ftgl/2.1.3rc5        mricron/20090707
R/2.10.0             gams/22.0            namd/2.7b2
abaqus/6.9-2         gams/22.1            openmpi/gnu/1.3.3
abinit/5.8.4p        gams/22.7            openmpi/intel/1.3.3
afni/2008_07_18_1710 gaussian/g03e1       openmpi/pgi/1.3.3
ampl/10.1            gcc/4.3.4            papi/20090803
ansys/12.0           gcc/4.4.2            papi/3.7.0
avizo/6.1.1          glpk/4.40            pcre/8.00
blast/2.2.22         gmp/4.3.1            perl/5.10.1
blast+/2.2.22        gromacs/4.0.5        pgi/9.0-2
blat/3.4             gsl/1.13             ppl/0.10.2
cloog-ppl/0.15.7     hdf5/1.6.9           python/2.6.3
cmake/2.6.4          hdf5/1.8.3           python/3.1.1
cmake/2.8.0-rc3      icewm/1.2.37         qhull/2003.1
comsol/3.5a          intel/11.0.084       realvnc/4.5r21561
cplex/10.1           intel/11.1.059       schrodinger/2009.1
cplex/11.0           java/1.6.0_17        schrodinger/2009.2
...

The format of the listed packages is <package name>/<package version>. For example, gcc/4.4.2 is version 4.4.2 of gcc.

A slightly more informative listing can be attained by using the module whatis command.

[abc123@lionxi ~]$ module whatis
...
mkl/10.1.3.027       : Intel Math Kernel Library version 10.1.3.027
mkl/10.2.1.017       : Intel Math Kernel Library version 10.2.1.017
mkl/10.2.2.025       : Intel Math Kernel Library version 10.2.2.025
mni                  : MNI-BIC software distribution
modules              : loads the modules environment
mpfr/2.4.1           : GNU Multi Precision Floating-Point Reliable Library 2.4.1
mricro/1.39.4        : MRIcro version 1.39.4
mricron/20090707     : MRIcron version 20090707
namd/2.7b2           : NAMD version 2.7b2
openmpi/gnu/1.3.3    : OpenMPI version 1.3.3 for GNU compilers
openmpi/intel/1.3.3  : OpenMPI version 1.3.3 for Intel compilers
openmpi/pgi/1.3.3    : OpenMPI version 1.3.3 for PGI compilers
...

Listing Currently Loaded Packages

To see what packages are currently loaded into a user's environment, the command is module list.

[abc123@lionxi ~]$ module list
Currently Loaded Modulefiles:
  1) gmp/4.3.1             5) gcc/4.4.2             9) gromacs/4.0.5
  2) mpfr/2.4.1            6) intel/11.1.059       10) matlab/R2009b
  3) ppl/0.10.2            7) openmpi/intel/1.3.3
  4) cloog-ppl/0.15.7      8) mkl/10.2.2.025

The above listing shows that this user has 10 packages loaded including the Intel compilers version 11.1.059, gcc 4.4.2, Gromacs 4.0.5, and Matlab R2009b.

Loading a Package

The command for loading a package into a user's environment is module load <package name>. This loads the most recent version of <package name>. If a specific version of a package is desired, the command can be expanded to module load <package name>/<package version>.

[abc123@lionxi ~]$ module avail gcc

-------------------- /usr/global//Modules/3.2.6/modulefiles --------------------
gcc/4.3.4 gcc/4.4.2
[abc123@lionxi ~]$ module load gcc
[abc123@lionxi ~]$ gcc --version | head -n 1
gcc (GCC) 4.4.2
[abc123@lionxi ~]$ module unload gcc
[abc123@lionxi ~]$ module load gcc/4.3.4
[abc123@lionxi ~]$ gcc --version | head -n 1
gcc (GCC) 4.3.4

Note that Environment Modules will load any prerequisites for a package when that package is loaded. In the following example, the user starts without any packages loaded and then loads gcc. gcc has several supporting libraries that it needs to run, so these packages are automatically loaded.

[abc123@lionxi ~]$ module list
No Modulefiles Currently Loaded.
[abc123@lionxi ~]$ module load gcc
[abc123@lionxi ~]$ module list
Currently Loaded Modulefiles:
  1) gmp/4.3.1          3) ppl/0.10.2         5) gcc/4.4.2
  2) mpfr/2.4.1         4) cloog-ppl/0.15.7

Unloading a Package

The command to unload a package is module unload <package name>. This command will also remove any prerequisties for the package being removed.

[abc123@lionxi ~]$ module list
No Modulefiles Currently Loaded.
[abc123@lionxi ~]$ module load gcc
[abc123@lionxi ~]$ module list
Currently Loaded Modulefiles:
  1) gmp/4.3.1          3) ppl/0.10.2         5) gcc/4.4.2
  2) mpfr/2.4.1         4) cloog-ppl/0.15.7
[abc123@lionxi ~]$ module unload gcc
[abc123@lionxi ~]$ module list
No Modulefiles Currently Loaded.

Using Environment Modules with PBS

The module for a software package needs to be loaded within a PBS job as well. A sample PBS script for running the application R with the input file R.in and the output file R.out would be as follows.

#PBS -l nodes=1:ppn=1
#PBS -l walltime=24:00:00
#PBS -j oe

cd $PBS_O_WORKDIR

module load R
R --no-save --no-restore < R.in > R.out

Making Modules Load Automatically on Login

Modules can be loaded automatically on login by adding the appropriate module load commands to a user's .bashrc file. The .bashrc file is located in the top level of a user's home directory. The following example shows a .bashrc file that automatically loads R, Abinit, and Gaussian.

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi

# User specific aliases and functions

module load R
module load abinit
module load gaussian