Skip to content

Environment Modules

There are a variety of software packages, compilers and libraries installed, each of which require different environment variables and paths to be set up. This is handled via environment modules. At any time a module can be loaded or unloaded and the environment will be automatically updated so as to be able to use the desired software and libraries.

Info

If the user requires a module which does not exist please contact support@archie-west.ac.uk to enable installation by ARCHIE-WeSt Support Team.

Tip: modules should be loaded from within job scripts

We recommend that module load commands are inserted within job scripts.

Users should load specific modules from within their jobs scripts. This is so that if a job script is preserved along with data from a job, it is obvious as to which version of the software was used for that run.

If the user wishes to load a default set of modules from ther bashrc file, then any module load commands in a job script should be preceded by "module purge".

Basic Commands

The module commands can be loaded from the terminal or added to the jobscript. In the first case the modules will "work" only at the terminal from which they were loaded while loading modules from the jobscript gives better controll on the used modules. Note that the order of loading modules might be important in some cases, therefore before loading them within the jobscript the user should load them from the terminal.

Command Action
module avail lists available modules
module list list loaded modules
module rm removes specified module
module purge removes all the modules

Examples

Listing all module variations for a particular package

Example

The command:

module avail ansys

will list all available versions of ansys.

-------------------------------------------- /opt/software/modules --------------------------------------------
ansys/16.0    ansys/17.0    ansys/18.1 (D)

Loading and Unloading Modules

Example

The command:

module load namd/intel-2016.4/2.12

would load the NAMD software ver. 2.12 (compiled with the Intel compiler version 2016.4) while the command:

module rm  namd/intel-2016.4/2.12

would unload this module.

Unloading All Modules

Example

To unload all loaded modules:

module purge

then the command:

module list

would give:

No Modulefiles Currently Loaded

Replacing Package Version

Example

If the user already loaded ansys ver. 17.0 the command:

module list

would list the module as ansys/17.0

Currently Loaded Modules:
  1) ansys/17.0

To replace it by more recent version first the user needs to remove the current module by:

module rm ansys/17.0

Then to load other version of ansys

module load ansys/18.1

Now the command:

module list

would list the module as ansys/18.1

Currently Loaded Modules:
  1) ansys/18.1

Job script module commands

Module commands can be inserted within jobs scripts and this is the recommended method for loading modules for jobs.

However, if a user has a default set of modules loaded from their bashrc file, or from the terminal from which they are submitting their job, then "module purge" should be used as in the example below:

#!/bin/bash

#======================================================
#
# Job script for running OpenFOAM on a single node
#
#======================================================

#======================================================
# Propogate environment variables to the compute node
#SBATCH --export=ALL
#
# Run in the standard partition (queue)
#SBATCH --partition=standard
#
# Specify project account
#SBATCH --account=testing
#
# No. of tasks required (max. of 40)
#SBATCH --ntasks=40
#
# Ensure the node is not shared with another job
#SBATCH --exclusive
#
# Specify (hard) runtime (HH:MM:SS)
#SBATCH --time=01:00:00
#
# Job name
#SBATCH --job-name=openfoam_test
#
# Output file
#SBATCH --output=slurm-%j.out
#======================================================

module purge
module load openfoam/intel-2018.2/v1712

#=========================================================
# Prologue script to record job details
#=========================================================
/opt/software/scripts/job_prologue.sh 
#----------------------------------------------------------

mpirun -np $SLURM_NPROCS dsmcFoam -parallel

#=========================================================
# Epilogue script to record job endtime and runtime
#=========================================================
/opt/software/scripts/job_epilogue.sh 
#----------------------------------------------------------