Modules

Overview

Modules is the system by which most software is made available. Modules allow, via a simple interface, the update of various paths (and other environment settings) that allow access to software.

The use of modules also provides a convenient way to switch between different versions of the same software (such as compilers).

Some applications are only relevant on specific back-end nodes (e.g. Nvidia GPU software can only be run on a back-end node containing the required GPU).

Commands

The environment is controlled using the module command with various arguments:

  • module list – lists currently loaded modules
  • module avail – lists all available modules
  • module load modulename – loads module “modulename”
  • module unload modulename – unloads module “modulename”
  • module switch oldmodulename newmodulename – switches between two modules
  • module initadd modulename – run this command once to automatically ensure that a module is loaded when you log in. (It creates a .modules file in your home dir which acts as your personal configuration.)
  • module purge – unload all modules
  • module help – brief list of all the available module commands
  • man module – detailed explanation of the above commands and others

Categories

The software available on Zrek has been placed in categories:

  • apps – for main applications which has subsections for the compiler used to build an application – for example, intel-11.1 – or where no compile was required – binapps.
  • compilers
  • libs – for example, NAG, mkl
  • mpi

The module avail command will list everything available. You can view a single category at a time with:

module avail <category>
  #
  # replacing the optional <category> with one of the above

To use a module/piece of software:

module load <module name>
  #
  # replacing <module name> with the module you want

For example:

module load compilers/intel/fortran/11.1.064

It is possible, and often necessary, to have multiple modules loaded at once.

Bash Completion

The module paths on Zrek are lengthy, but you can use bash completion to help you. Press TAB part-way through typing a module name and the name will be completed for you or a list of possible completions will be given. Type a few more characters and hit TAB again to narrow the list down until you get the full module name.

Seeing module environment settings in batch

We recommend that you load all relevant modules before you submit to batch (i.e., before calling qsub) and ensure that in your batch script you have the following line to pick up the environment settings:

#$ -V

Note: That is an uppercase V.

Loading modules in batch

If you prefer to load your modules within the batch script you must start the batch script with the following line:

#!/bin/bash -l

Note: That is a lowercase letter ‘el’, not a number one.

You can then do the usual jobscript commands and also include module commands. For example:

#!/bin/bash -l
#$ -V
#$ -cwd
module load compilers/intel/c/12.0.5
./my_app

This is generally not recommended because any mistakes in the names of the modules, for example, will mean your environment isn’t set up correctly when you try to run your application. You will have to resubmit your job (which will mean waiting in the job queue again!)

It is recommended that you set up your environment correctly before submitting your job to the batch system. The batch system takes a copy of your environment at the time at which you run the qsub command, not when your job eventually runs. This means that after submitting your job with qsub you are free to change your environment or even log out and your job will still see the correct environment.

Further Information

Last modified on September 24, 2014 at 10:44 am by Site Admin