Modules
Environment Modules at RZG
Introduction:
RZG uses modules to adapt the user environment for working with software installed at various locations in the file system or for switching between different software versions. The user is no longer required to explicitly specify paths for different executable versions, or keep track of PATH, MANPATH and related environment variables. With the modules approach, users simply 'load' and 'unload' modules to control their environment. System administrators provide modulefiles, typically named by the software package and an optional version number. All popular shells are supported, including bash, ksh, and tcsh. Besides handling different software versions, the modules approach allows system administrators to install software in non-standard locations and also to relocate software packages transparently for the user (by adapting the modulefile). It is therefore highly recommended for users to specify the variables provided in modules in makefiles, scripts, etc. instead of relying on absolute paths (see below for examples).
Basic usage:
Here is a list of the most important commands (see http://modules.sourceforge.net/ for a complete reference):
module help lists module subcommands and switchesmodule avail lists available software packages and versions which can be enabled ("loaded") with the module command.module apropos <keyword> searches available modulefiles for the specified keyword string and list all matching modules.module help <package>/<version> provides brief documentation for the specified module.module show <package>/<version> provides information about the impact of the specified module to the user's environment.module load <package>/<version> "loads" the module, i.e. modifies the user's environment ($PATH, $MANPATH, etc.)module unload <package>/<version> "unloads" the modulemodule list lists all modules which are currently loaded in the user's environment
Scripts:
Environment modules are provided by default only in interactive login shells. For non-interactive shells (e.g. in shell scripts) the following system profiles must be explicitly sourced:
Linux (SLES):
/etc/profile.d/modules.cshfor csh-derivative shells: csh, tcsh/etc/profile.d/modules.shfor sh-derivative shells: sh, bash
AIX:
/etc/functions/modulefor sh-derivative shells: sh, ksh, bash- explicit sourcing of system profile not necessary for csh-derivative shells: csh, tcsh
Instead of absolute paths to libraries, binaries etc. the environment variables set by the modulefile should be used in scripts, makefiles etc. By convention, an RZG modulefile sets an environment variable named <PKG>_HOME (where PKG is the name of the package, for examle: MKL_HOME) which points to the root directory of the installation path (see below for example usage). Information about additional, package-specific environment variables can be obtained with the commands module help <package>/<version> and module show <package>/<version>.
Examples:
1) Interactive session on the command line, using the Intel fortran compiler (default version) and Intel MKL (version 10.2 explicitly specified):
~> module load intel ~> module load mkl/10.2 ~> ifort -I$MKL_HOME/include example.F -L$MKL_HOME/lib/em64t -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
2) Makefile (fragment):
FC=ifort
example: example.F
$(FC) -I$MKL_HOME/include test.F -L$MKL_HOME/lib/em64t -lmkl_intel_lp64 -lmkl_sequential -lmkl_core
