Configure the Development Environment with Modules

How to list and load various modules for the development environment.

Each modulefile contains information needed to configure the shell for an application. Once the Modules package is initialized, use module to customize the environment at the module level. Typically modulefiles instruct the module command to alter or set shell environment variables such as $PATH, $MANPATH, etc. Modulefiles may be shared by many users on a system, and users may have their own collection to supplement or replace the shared modulefiles.

Add or remove modulefiles from the current environment as needed. The environment changes contained in a modulefile can be summarized through the module command as well. If no arguments are given, a summary of the module usage and sub-commands are shown. The action for the module command to take is described by the sub-command and its associated arguments.

After logging in, load the desired collection of modules by running the following command:
module restore <collection_name>
To switch between the different module collections at anytime, run the module restore command.
Note: Do not load/unload cpe-<compiler> modules. Instead, use the module restore command.

List Loaded Modules

user@system037:~> module list
Currently Loaded Modulefiles:
 1) cpe-cray  
 2) cce/11.0.1(default)                               
 3) craype/2.7.0(default)
 4) craype-x86-rome
 5) libfabric/1.10.2pre1(default)
 6) craype-network-ofi
 7) cray-mpich/8.0.16(default) 
 8) cray-libsci/20.03.1.4(default)

List Available Module Collections

List all available module collections:
user@system037:~> module savelist
 1) PrgEnv-aocc   2) PrgEnv-cray   3) PrgEnv-gnu

List Available Modules

List all available modules:
user@system037:~> module avail
List all available modules of a certain type (for example module avail cce):
user@system037module avail cce

--------------------------------------------------------------------------------- /opt/cray/pe/modulefiles ----------------------------------------------------------------------------------
cce-sve/10.0.0(default)

Load Modules

Load the default version of a module:
user@system037:~> module load cce
Load a specific version of a module:
user@system037:~> module load cce/version

Unload Modules

Remove a module:
user@system037:~> module unload cray-libsci

Change Module Versions

Swap out the default module for a specific version:
user@system037:~> module switch cce cce/version

Change Programming Environments

To restore module collections, use module restore to unload one collection and restore the other.
user@system037:~> module restore PrgEnv-gnu

Show Collections

Display information about module collections:
user@system037:~> module saveshow PrgEnv-cray
-------------------------------------------------------------------
/home/users/user21/.module/PrgEnv-cray:
 
module use --append /opt/cray/pe/perftools/20.10.0/modulefiles
module use --append /usr/local/Modules/modulefiles
module use --append /opt/cray/pe/cpe-prgenv/7.0.0
module use --append /opt/modulefiles
module use --append /opt/cray/modulefiles
module use --append /opt/cray/pe/modulefiles
module use --append /opt/cray/pe/craype-targets/default/modulefiles
module load cpe-cray
module load cce
module load craype
module load craype-x86-rome
module load --notuasked libfabric
module load craype-network-ofi
module load cray-dsmml
module load perftools-base
module load xpmem
module load cray-mpich
module load cray-libsci
-------------------------------------------------------------------

Show Module Information

Display information about module conflicts and links:
user@system037:~> module show PrgEnv-cray
-------------------------------------------------------------------
/opt/cray/pe/modulefiles/PrgEnv-cray/7.0.0:

conflict        PrgEnv
conflict        PrgEnv-gnu
conflict        PrgEnv-pgi
conflict        PrgEnv-cray
setenv          PE_ENV  CRAY
prepend-path    PE_PRODUCT_LIST CRAY
setenv          cce_already_loaded      1
module load     cce/9.1.3
setenv          craype_already_loaded   1``
module load     cray-libsci
module load     xpmem
module load     dvs
module load     perftools-base
setenv          CRAY_PRGENVCRAY loaded
-------------------------------------------------------------------

Swap Other Programming Environment Components

Note that for products which contain dynamically linked libraries, such as MPI, switching the module environment does not completely change the run time environment because the dynamic libraries are cached by the runtime linker, as specified by /etc/ld.so.conf. To use a nondefault version of a dynamic library at run time, prepend CRAY_LD_LIBRARY_PATH to LD_LIBRARY_PATH.

The following commands revert the environment to an earlier version of 8.0 cray-mpich:

$ module swap cray-mpich/8.0.5.4 cray-mpich/8.0.3
$ export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}