Using Modules
Categories: Modules
Modules Overview
Each modulefile contains the information needed to configure the shell for an application. After the modules software package is initialized, the environment can be modified on a per-module basis using the module
command, which interprets a modulefile.
Typically, a modulefile instructs the module command to alter or set shell environment variables such as PATH
or MANPATH
. Modulefiles can be shared by many users on a system, and users can have their own personal collection to supplement and/or replace the shared modulefiles.
As a user, you can add and remove modulefiles from your current shell environment. The environment changes performed by a modulefile can be viewed by using the module
command as well.
More information on modules can be found by running man module
on OLCF systems.
Summary of Module Commands
Command | Description |
---|---|
module list |
Lists modules currently loaded in a user’s environment |
module avail |
Lists all available modules on a system in condensed format |
module avail -l |
Lists all available modules on a system in long format |
module display |
Shows environment changes that will be made by loading a given module |
module load |
Loads a module |
module unload |
Unloads a module |
module help |
Shows help for a module |
module swap |
Swaps a currently loaded module for an unloaded module |
Re-initializing the Module Command
Modules software functionality is highly dependent upon the shell environment being used. Sometimes when switching between shells, modules must be re-initialized. For example, you might see an error such as the following:
$ module list -bash: module: command not found
To fix this, just re-initialize your modules environment:
$ source $MODULESHOME/init/myshell
Where myshell
is the name of the shell you are using and need to re-initialize.
Examples of Module Use
To show all available modules on a system:
$ module avail ------------ /opt/cray/modulefiles ------------ atp/1.3.0 netcdf/4.1.3 tpsl/1.0.01 atp/1.4.0(default) netcdf-hdf5parallel/4.1.2(default) tpsl/1.1.01(default) atp/1.4.1 netcdf-hdf5parallel/4.1.3 trilinos/10.6.4.0(default) ...
To search for availability of a module by name:
$ module avail -l netcdf - Package -----------------------------+- Versions -+- Last mod. ------ /opt/modulefiles: netcdf/3.6.2 2009/09/29 16:38:25 /sw/xk6/modulefiles: netcdf/3.6.2 2011/12/09 18:07:31 netcdf/4.1.3 default 2011/12/12 20:43:37 ...
To show the modulefiles currently in use (loaded) by the user:
$ module list Currently Loaded Modulefiles: 1) modules/3.2.6.6 12) pmi/3.0.0-1.0000.8661.28.2807.gem 2) xe-sysroot/4.0.30.securitypatch.20110928 13) ugni/2.3-1.0400.3912.4.29.gem 3) xtpe-network-gemini 14) udreg/2.3.1-1.0400.3911.5.6.gem
To show detailed help info on a modulefile:
$ module help netcdf/4.1.3 ------------ Module Specific Help for 'netcdf/4.1.3' ------------ Purpose: New version of hdf5 1.8.7 and netcdf 4.1.3 Product and OS Dependencies: hdf5_netcdf 2.1 requires SLES 11 systems and was tested on Cray XE and ...
To show what a modulefile will do to the shell environment if loaded:
$ module display netcdf/4.1.3 ------------ /opt/cray/modulefiles/netcdf/4.1.3: setenv CRAY_NETCDF_VERSION 4.1.3 prepend-path PATH /opt/cray/netcdf/4.1.3/gnu/45/bin ...
To load or unload a modulefile
$ module load netcdf/4.1.3 $ module unload netcdf/4.1.3
To unload a modulefile and load a different one:
$ module swap netcdf/4.1.3 netcdf/4.1.2