NERSCPowering Scientific Discovery Since 1974

Save and restore programming environment versions

The default programming environment on Cori changes over time. Usually the Cray Developer Toolkit (CDT) version is upgraded about every six months on Cori so that users can get benefit from the enhanced software features and performance. However, if you need to compile a code with a specific version of CDT which is not  the default version anymore, or if your code works best with a mix of default and non-default software modules and you want to recompile with the same set of modules, then you can use the Cray provided cdt modules or the module snapshot feature to restore the compilation environment where your code was built previously. 

Module Snapshot

The module subcommand "snapshot" is available starting from modules/ The command captures the currently loaded modules and saves the list into a file for later restore. Here is how to use it:

To save the current module environment into a file, do

module snapshot -f filename

The file can be provided with a full path or just with a file name. If a full path is not given, then the snapshot will be saved in your ${HOME}/.module_snapshots directory. An environment variable, MODULE_SNAPSHOT_DIR can be used to use an alternative location. 

To restore later, do

module restore filename

If a file is not provided with a full path, then the $MODULE_SNAPSHOT_DIR will be searched first, followed by $HOME/.module_snapshots. 

Here is the demo: 

save modules

restore modules


Note, you may see the module restore command fails sometime, depending on the modules loaded in the current environment and the ones to be loaded in the module snapshot file. If this occurs, try a fresh login session before executing the module restore command. You may also see errors with the module restore command if the software modules in your snapshot do not exists anymore. Please report any problems with the module snapshot feature to   

CDT modules

The cdt modules are provided by Cray to do a clean switch between different CDT modules. Type module avail cdt to see the available cdt modules.

cdt switch