Using the Module Environment

The compilation and execution environment installed on Marc2 is defined using modules command. For a list of available modules, use the avail sub-command:

$ module avail

---------------------------------- /usr/share/Modules/modulefiles ----------------------------------
dot         module-cvs  module-info modules     null        use.own

------------------------------------- /usr/share/ModulesLocal --------------------------------------
acml/gfortran-5.1.0(default)           parastation/mpi2-gcc-mt-5.0.27-1
acml/ifort-5.1.0                       parastation/mpi2-intel-5.0.27-1
acml/pgi-5.1.0                         parastation/mpi2-intel-mt-5.0.27-1
gcc/4.4.6                              parastation/mpi2-pgi-5.0.27-1
gcc/4.6.2(default)                     parastation/mpi2-pgi-mt-5.0.27-1
parastation/mpi2-gcc-5.0.27-1(default) pgi/12.2(default)

To show all currently loaded modules, use list:

$ module list
Currently Loaded Modulefiles:
  1) acml/gfortran-5.1.0             3) parastation/mpi2-gcc-5.0.27-1
  2) gcc/4.6.2

To load a specific module, use load:

$ module load parastation/mpi2-gcc-5.0.27-1

For more details, see man module. Other important commands:

  1. module avail: shows a list of available modules
  2. module list: lists the currently loaded modules
  3. module unload <module>: removes a module
  4. module purge: removes all loaded modules

Note: at interactive login a default set of modulefiles is loaded. In contrast, a batch job is started in a clean minimal environment where even the module command is not available. In a job script you can load the shell functions that implement the module command by either the line

. /etc/profile.d/

or, alternatively, you can declare the executing shell to be a login shell :

#!/bin/bash -l