Using Modules on the Cluster

What are Environment Modules?

The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. IRMACS uses modules to enable the consistent and simple configuration of software packages on the IRMACS cluster. The modules environment is loaded automatically when you log in to the IRMACS cluster head node and will be loaded automatically for each cluster job.

Modules are useful in managing different versions of applications. Modules can also be bundled into metamodules that will load an entire suite of different applications. Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command which interprets modulefiles. Typically modulefiles instruct the module command to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system and users may have their own collection to supplement or replace the shared modulefiles.

Modules can be loaded and unloaded dynamically and atomically, in an clean fashion. All popular shells are supported, including bash, ksh, zsh, sh, csh, tcsh, as well as some scripting languages such as perl.

Modules Quick Start

Every user has the module environment configured when they log in to the cluster head node. This makes the "module" command available. To see a list of available modules you can type

module avail

which will show something similar to the example below

----------- /hpc/software/Linux-x86_64/Modules/versions
3.2.8
----------- /hpc/software/Linux-x86_64/Modules/3.2.8/modulefiles
COMPILERS/OPENMPI/1.4.4 dot modules
LANG/R/2.14.0 module-cvs null
TOOLS/MRBAYES/3.1.2 module-info use.own

If you want to use one of the modules, in this example R 2.14.0, you simply type

module load LANG/R/2.14.0

After the module is loaded you simply need to type in "R" from the command line to run the application.

Using Modules within cluster submission scripts files

Modules are designed such that using advanced applications are simple and transparent. You simply load the module for the software you want to use and then use the application. This technique should also be used in cluster submission scripts. For example, to use R on a cluster node, a submission script like the one below can be used.

#PBS -S /bin/bash
#PBS -l nodes=1:ppn=1,mem=1g,walltime=1:00:00

### Load the R module
module load LANG/R/2.14.0

### Do something with R
R --vanilla --no-save < mycode.r

Configuring modules

If you are having problems using modules please send an email to "help @ irmacs.sfu.ca". If you are having problems, you might want to try issuing the following command (for the bash shell).

. /hpc/software/Linux-x86_64/Modules/3.2.8/init/bash

This will initialize the module environment. This should occur automatically at log in, so if this is not working for you please let us know.