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-sve/10.0.0(default)   
 3) craype/2.6.6(default)     
 4) craype-arm-nsp1
 5) craype-network-infiniband
 6) cray-libsci/20.08.1.1(default)
 7) perftools-base/20.08.0(default)
 8) cray-mvapich2_nogpu_svealpha/2.3.4(default)

List Available Module Collections

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

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)

Restore Collections

Restore module collections:
user@system037:~> module restore PrgEnv-cray

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

Modules may be linked and related. Entering module list after changing the programming environment, shows that, in addition to the programming environment version change, the supporting product versions may also have changed.

Show Collections

Display information about module collections:
user@system037:~> module saveshow
module saveshow PrgEnv-cray
-------------------------------------------------------------------
/home/users/user21/.module/PrgEnv-cray:

module use --append /opt/cray/pe/craype-targets/default/modulefiles
module use --append /opt/cray/pe/modulefiles
module use --append /opt/modulefiles
module use --append /opt/cray/pe/cpe-prgenv/7.0.0
module use --append /usr/share/Modules/modulefiles
module use --append /etc/modulefiles
module use --append /usr/share/modulefiles
module load cpe-cray
module load cce-sve
module load craype
module load craype-arm-nsp1
module load craype-network-infiniband
module load cray-libsci

Swap Other Programming Environment Components

Be aware that for products that contain dynamically linked libraries, such as MPI, switching the MPI module environment does not completely change the run time environment because the dynamic libraries are located in the cache used by the run time linker, as specified by /etc/ld.so.conf. To use a non-default version of a dynamic library at run time the user should prepend CRAY_LD_LIBRARY_PATH to LD_LIBRARY_PATH.

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

$ user@login> module swap cray-mvapich2_nogpu_svealpha/2.3.4 cray-mvapich2_nogpu_svealpha/2.3.3pre2
$ export LD_LIBRARY_PATH=${CRAY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}