Modules: Details - nthu-ioa/cluster GitHub Wiki

Each module is defined by a modulefile. These contain recipes to modify shell environment variables (PATH, MANPATH, LD_RUN_PATH etc.) to set up a particular package. Importantly, the changes made by module load are reversed by module unload, regardless of the order in which the modules are loaded and unloaded.

For example, one of the lines in /cluster/software/modulefiles/gcc/8.3.0 is:

prepend-path PATH /cluster/software/gcc/8.3.0/bin

which tells Modules to add the location of the 8.3.0 gcc binaries (/cluster/software/gcc/8.3.0/bin) to the front of the PATH environment variable. When module unload gcc is called, that element is removed from PATH.

The syntax of these files is described in man modulefiles.

More commands

module show foo prints a summary of the changes made when the foo module is loaded.

module help foo prints any additional documentation included in the foo modulefile by its author. Adding documentation to modulefiles is optional.

module purge unloads all currently loaded modules. This can be useful in batch scripts to ensure a clean environment.

For even more commands, see the Modules documentation.