Environment Modules

Last update: Jan 27, 2025

Introduction

Environment Modules ("module" command) is an OPTIONAL tool in RCCS. 

Notices

  • If both of login shell and job scripts are sh/bash/zsh, no extra lines are required.
  • If your login shell OR your job script is csh, extra line is required in job script.
    • if your job script is csh script, "source /etc/profile.d/modules.csh" is required in job submission script before using module command
    • if your login shell is csh but the job script is bash script, you need to add "source /etc/profile.d/modules.sh" in the script (". /etc/profile.d/modules.sh" also works).

Basic Usage

Loading/unloading modules can be done with "module" command. This command is available both in login server and computation nodes. Some of packages may be loaded upon login.

You can find packages with "module avail" command or from the installed applications page. Then, load the package with "module load" command. List of currently loaded modules can be shown with "module list" command. Regarding module commands (such as avail, load, list), please also check the next section.

Modules are not available for some of applications. Please check installed applications page mentioned above or /apl directory for them.

Commands

We here show some example of basic commands. However, there are many other useful commands. Please check them in the official page or search the internet.

Job scripts examples

/bin/sh script

#!/bin/sh
#PBS select=ncpus=1:mpiprocs=1:ompthreads=1:ngpus=1
#PBS -l walltime=72:00:00

if [ ! -z $PBS_O_WORKDIR ]; then
  cd $PBS_O_WORKDIR
fi

module -s purge
module -s load amber/20u13

pmemd.cuda -O -i mdin ......

If your login shell is csh, you need to add "source /etc/profile.d/modules.sh"(source can be replaced with ".") before module purge command line. At first all the loaded modules are unloaded with "purge" command. Then, the target module is loaded. This is the basic usage. NOTE: in the example above, output of module command is completely discarded anyway due to the "-s" option. If there is a possibility that the module command is failed, please remove "-s" option.
 

/bin/csh script

For csh/tcsh, module command is defined as an alias in /etc/profile.d/modules.csh.
You don't need a special setting in interactive shell.
However, in the job script, you need to source /etc/profile.d/modules.csh explicitly.

#!/bin/csh -f
#PBS select=ncpus=1:mpiprocs=1:ompthreads=1:ngpus=1
#PBS -l walltime=72:00:00

if ( $?PBS_O_WORKDIR ) then
  cd $PBS_O_WORKDIR
endif

source /etc/profile.d/modules.csh # required!
module -s purge
module -s load amber/20u13

pmemd.cuda -O -i mdin .......

Reference