3. THE module COMMAND

Table of Content
The module-command: module
List available modules: module avail
Clear list of loaded modules: module clear
Display information about chances in environment when loaded: module display
Print sub-command or module-specific help: module help
Add or remove modules from shell’s initialization file: module initcmds
Search for keywords in 'whatis': [module-keyword]
List loaded modules: module list
Load and unload modules: module load|unload
Purge all loaded modules: module purge
Refresh loaded modules: module refresh
Search installed modules: module search
Replace a loaded module by another: module swap
Manipulate module path, used releases, groups and overlays: module use
Search for keywords in 'whatis': module whatis|keyword

3.1. module - using Pmodules

NAME

module - command line interface to the Pmodules package

SYNOPSIS

module [ switches ] [ sub-command ] [ sub-command-args ]

DESCRIPTION

Environment Modules provide a convenient way to dynamically change the users' environment through modulefiles. This includes easily adding or removing directories to the PATH environment variable. A modulefile contains the necessary information to allow a user to run a particular application or provide access to a particular library. All of this can be done dynamically without logging out and back in. Modulefiles for applications modify the user’s shell environment to make access easy. Modulefiles for Library packages provide environment variables that specify where the library and header files can be found. Packages can be loaded and unloaded cleanly through the module command.

Available sub-commands are:

List available modules: module avail

Clear list of loaded modules: module clear

Display information about chances in environment when loaded: module display

Print sub-command or module-specific help: module help

Add or remove modules from shell’s initialization file: module initcmds

Search for keywords in 'whatis': [module-keyword]

List loaded modules: module list

Load and unload modules: module load|unload

Purge all loaded modules: module purge

Refresh loaded modules: module refresh

Search installed modules: module search

Replace a loaded module by another: module swap

Manipulate module path, used releases, groups and overlays: module use

Search for keywords in 'whatis': module whatis|keyword

For the time being Pmodules supports bash, tcsh and zsh only.

3.2. Sub-commands

3.2.1. List available/loadable modules

NAME

module avail - list loadable modules

SYNOPSIS

module avail [OPTIONS] [string…​]

DESCRIPTION

List all available module in the current MODULEPATH. If an argument is given, then each directory in the MODULEPATH is searched for modules whose pathname match the argument.

This command does not display all installed modules on the system. Only loadable modules are listed. To get a list of all installed modules use the command module search.

The list of available modules may change either by loading other modules, e.g. a compiler, or by using/accepting unstable or deprecated modules. For the later read the description of module use.

With the switches you can change the output format. The default output format is 'human' (readable). For the time being terse and long output are identical.

OPTIONS
-a

List loadable modules in all release-stages. Unstable modules are marked with (u), deprecated modules with (d).

-t | --terse

Terse output.

-h | --human

Human readable output. This is the default.

-l | --long

Long output.

EXAMPLES
$ module avail git
----------------------------------------- Tools -----------------------------------------

ygit/2.3.3       git/2.8.1       git/2.21.0      git/2.22.0      git/2.30.0      git/2.33.1

$ module avail -a gcc
-------------------------------------- Programming --------------------------------------

gcc/4.7.4       gcc/4.8.2       gcc/4.8.3       gcc/4.8.4       gcc/4.8.5       gcc/4.9.2
gcc/4.9.3       gcc/4.9.4       gcc/5.1.0(d)    gcc/5.2.0(d)    gcc/5.3.0       gcc/5.4.0
gcc/5.5.0       gcc/6.1.0       gcc/6.2.0       gcc/6.3.0       gcc/6.4.0       gcc/6.5.0
gcc/7.1.0       gcc/7.2.0       gcc/7.3.0       gcc/7.4.0       gcc/7.5.0       gcc/8.1.0
gcc/8.2.0       gcc/8.3.0       gcc/8.4.0       gcc/8.5.0       gcc/9.1.0       gcc/9.2.0
gcc/9.3.0       gcc/9.5.0       gcc/10.1.0      gcc/10.2.0      gcc/10.3.0      gcc/11.2.0
gcc/11.3.0      gcc/12.1.0

3.2.2. Clear list of loaded modules

NAME

module clear - clear list of loaded modules.

SYNOPSIS

module clear

DESCRIPTION

Force the Pmodules package to believe that no modules are currently loaded. The sub-command clear does not unload the loaded modules! In other words: changes made to the shell’s environment by loaded modules are not reverted.

EXAMPLES

After loading the module for gcc/4.9.2 the following environment variables are set:

$ env | grep ^GCC
GCC_HOME=/opt/psi/Programming/gcc/4.9.2
GCC_DIR=/opt/psi/Programming/gcc/4.9.2
GCC_PREFIX=/opt/psi/Programming/gcc/4.9.2
GCC_VERSION=4.9.2
GCC_INCLUDE_DIR=/opt/psi/Programming/gcc/4.9.2/include
GCC_LIBRARY_DIR=/opt/psi/Programming/gcc/4.9.2/lib

After clearing the list of loaded modules the environment variables set by the GCC module are still set

$ module clear
$ module list
No Modulefiles Currently Loaded.
$ env | grep ^GCC
GCC_HOME=/opt/psi/Programming/gcc/4.9.2
GCC_DIR=/opt/psi/Programming/gcc/4.9.2
GCC_PREFIX=/opt/psi/Programming/gcc/4.9.2
GCC_VERSION=4.9.2
GCC_INCLUDE_DIR=/opt/psi/Programming/gcc/4.9.2/include
GCC_LIBRARY_DIR=/opt/psi/Programming/gcc/4.9.2/lib

3.2.3. Display information about a module

NAME

module display\|show - display information about chances in environment

SYNOPSIS

module display modulefile…​
module show modulefile…​

DESCRIPTION

Display information about modulefile(s). The display sub-command will list the full path of the modulefile(s) and all of the environment changes the modulefile(s) will make if loaded. (It will not display any environment changes found within conditional statements.)

EXAMPLES

Display chances the module gcc/5.4.0 will make to the environment if loaded:

$ module display gcc/5.4.0
-------------------------------------------------------------------
/opt/psi/Programming/modulefiles/gcc/5.4.0:

module-whatis	 GNU Compiler Collection
conflict	 gcc
setenv		 GCC_VERSION 5.4.0
setenv		 GCC_PREFIX /opt/psi/Programming/gcc/5.4.0
setenv		 GCC_DIR /opt/psi/Programming/gcc/5.4.0
setenv		 GCC_HOME /opt/psi/Programming/gcc/5.4.0
prepend-path	 PATH /opt/psi/Programming/gcc/5.4.0/bin
prepend-path	 MANPATH /opt/psi/Programming/gcc/5.4.0/share/man
prepend-path	 C_INCLUDE_PATH /opt/psi/Programming/gcc/5.4.0/include
prepend-path	 CPLUS_INCLUDE_PATH /opt/psi/Programming/gcc/5.4.0/include
setenv		 GCC_INCLUDE_DIR /opt/psi/Programming/gcc/5.4.0/include
prepend-path	 LIBRARY_PATH /opt/psi/Programming/gcc/5.4.0/lib
prepend-path	 LD_LIBRARY_PATH /opt/psi/Programming/gcc/5.4.0/lib
setenv		 GCC_LIBRARY_DIR /opt/psi/Programming/gcc/5.4.0/lib
prepend-path	 LIBRARY_PATH /opt/psi/Programming/gcc/5.4.0/lib64
prepend-path	 LD_LIBRARY_PATH /opt/psi/Programming/gcc/5.4.0/lib64
setenv		 GCC_LIBRARY_DIR /opt/psi/Programming/gcc/5.4.0/lib64
append-path	 PMODULES_LOADED_PROGRAMMING gcc/5.4.0
remove-path	 PMODULES_LOADED_PROGRAMMING --APPMARKER--
setenv		 COMPILER gcc
setenv		 COMPILER_VERSION 5.4.0
setenv		 CC /opt/psi/Programming/gcc/5.4.0/bin/gcc
setenv		 CXX /opt/psi/Programming/gcc/5.4.0/bin/g++
setenv		 F77 /opt/psi/Programming/gcc/5.4.0/bin/gfortran
setenv		 F90 /opt/psi/Programming/gcc/5.4.0/bin/gfortran
setenv		 FC /opt/psi/Programming/gcc/5.4.0/bin/gfortran
setenv		 FORTRAN /opt/psi/Programming/gcc/5.4.0/bin/gfortran
-------------------------------------------------------------------
SEE ALSO

3.2.4. Print sub-command or module-specific help

NAME

module help - print sub-command or module-specific help

SYNOPSIS

module help [module|sub-command…​]

DESCRIPTION

Print help for specific modules, sub-commands or the module command itself.

EXAMPLES

Get help for the module git/2.3.3:

$ module help git/2.3.3

----------- Module Specific Help for 'git/2.3.3' ------------------

distributed version control system
Version:    2.3.3
Homepage:   http://git-scm.com/
License:    GNU GPL v2
Maintainer: Achim Gsell <achim.gsell@psi.ch>

Git is a free and open source distributed version control system
designed to handle everything from small to very large projects
with speed and efficiency.

Git is easy to learn and has a tiny footprint with lightning fast
performance. It outclasses SCM tools like Subversion, CVS, Perforce,
and ClearCase with features like cheap local branching, convenient
staging areas, and multiple workflows.

Print help for the sub-command load:

$ module help load

USAGE:
        module add     modulefile...
        module load    modulefile...
                Load modulefile(s) into the shell environment. Loading a
		'group-head' will extend the MODULEPATH. E.g.: loading a
		compiler makes additional modules like openmpi and libraries
		compiled with this compiler available.

3.2.5. Manipulate shell’s initialization file

NAME

module initadd|initprepend|initrm|initswitch|initrm|initlist|initclear - add or remove modules from shell’s initialization file

SYNOPSIS

module initadd module…​
module initprepend module…​
module initrm module…​
module initswitch module1 module2
module initlist
module initclear

DESCRIPTION

Add modulefile(s) to, list modulefile(s) in or remove modulefile(s) from the shell’s initialization file in the user’s home directory. The startup files checked (in order) are:

csh

.modules, .cshrc(.ext), .csh_variables, and .login(.ext)

tcsh

.modules, .tcshrc, .cshrc(.ext), .csh_variables, and .login(.ext)

bash

.modules, .bash_profile, .bash_login, .profile(.ext), and .bashrc(.ext)

zsh

.modules, .zcshrc(.ext), .zshenv(.ext), and .zlogin(.ext)

module initadd module…​

If a module load line is found in any of these files, the modulefile(s) is(are) appended to any existing list of modulefiles. The module load line must be located in at least one of the files listed above for any of the init sub-commands to work properly. If the module load line is found in multiple shell initialization files, all of the lines are changed.

module initprepend module…​

Does the same as initadd but prepends the given modules to the beginning of the list.

module initrm module…​

Remove modulefile(s) from the shell’s initialization files.

module initswitch module1 module2

Switch module1 with module2 in the shell’s initialization files.

module initlist

List all of the module(s) loaded from the shell’s initialization file.

module initclear

Clear all of the module(s) from the shell’s initialization files.

3.2.6. List loaded modules

NAME

module list - list loaded modules

SYNOPSIS

module list [OPTIONS]

DESCRIPTION

List loaded modules.

OPTIONS
-t | --terse

Terse output.

-h | --human

Human readable output. This is the default.

-l | --long

Long output.

EXAMPLES

Assuming the modules gcc/4.8.3, openmpi/1.8.2 and hdf5/1.8.12. List with default (human readable) output:

$ module list
Currently Loaded Modulefiles:
  1) gcc/4.8.3       2) openmpi/1.8.2   3) hdf5/1.8.12

List in terse output:

$ module list -t
Currently Loaded Modulefiles:
gcc/4.8.3
openmpi/1.8.2
hdf5/1.8.12

Long listing:

$ module list -l
- Package -----------------------------+- Versions -+- Last mod. ------
Currently Loaded Modulefiles:
gcc/4.8.3                                            2014/12/05 17:39:24
openmpi/1.8.2                                        2014/11/25  8:15:40
hdf5/1.8.12                                          2014/11/25  8:15:40

3.2.7. Load and unloading a module

NAME

module add|load - load modules
module rm|unload - unload modules

SYNOPSIS

module add [OPTIONS] modulefile…​
module load [OPTIONS] modulefile…​
module rm modulefile…​
module unload modulefile…​

DESCRIPTION

Load modulefile(s) into shell environment. Loading a group-head will extend the MODULEPATH. E.g.: loading a compiler makes additional modules like openmpi and other libraries/packages compiled with this compiler available.

If you try to load a module which is not available in the current MODULEPATH but installed in the module hierarchy, a message will be printed showing prerequisite modules.

If you load a deprecated or unstable module, a warning will be printed.

You can change the verbosity of the load sub-command by setting the environment variable PMODULES_VERBOSITY to silent, warn or verbose.

silent

Print error messages only.

warn

Print a warning message, when loading a deprecated or unstable module.

verbose

Print warning messages and print prerequisite modules if the module to load is not available, but installed in hierarchy.

OPTIONS / FLAGS
-f | --force

Force active dependency resolution. This will result in modules found on a prereq command inside a module file being load automatically. Unloading module files using this switch will result in all required modules which have been loaded automatically using the -f switch being unload. This switch is experimental at the moment.

-v | --verbose

Set verbosity level to verbose.

-w | --warn

Set verbosity level to warn.

-s | --silent

Set verbosity level to silent.

EXAMPLES (add|load)

Loading the modules gcc/4.9.2, openmpi/1.8.4 and hdf5/1.8.14:

$ module load gcc/4.9.2
$ module load openmpi/1.8.4
$ module load hdf5/1.8.14
$ module list
Currently Loaded Modulefiles:
  1) gcc/4.9.2       2) openmpi/1.8.4   3) hdf5/1.8.14

or

$ module load gcc/4.9.2 openmpi/1.8.4 hdf5/1.8.14

If you try to load hdf5/1.8.14 without the prerequisite modules, some "hints" will be printed, if the default verbosity level is set:

$ module purge
$ module load hdf5/1.8.14
The module 'hdf5/1.8.14' cannot be loaded!
Try with one of the following command(s):

module load gcc/4.7.4 openmpi/1.6.5 hdf5/1.8.14
module load gcc/4.7.4 openmpi/1.8.2 hdf5/1.8.14
module load gcc/4.7.4 openmpi/1.8.4 hdf5/1.8.14
module load gcc/4.8.3 openmpi/1.6.5 hdf5/1.8.14
module use deprecated; module load gcc/4.8.3 openmpi/1.8.2 hdf5/1.8.14
module use deprecated; module load gcc/4.8.3 openmpi/1.8.4 hdf5/1.8.14
module load gcc/4.8.4 openmpi/1.6.5 hdf5/1.8.14
module use deprecated; module load gcc/4.8.4 openmpi/1.8.2 hdf5/1.8.14
module use deprecated; module load gcc/4.8.4 openmpi/1.8.4 hdf5/1.8.14
module use deprecated; module load gcc/4.8.4 openmpi/1.8.8 hdf5/1.8.14
module use deprecated; module load gcc/4.9.2 openmpi/1.6.5 hdf5/1.8.14
module use deprecated; module load gcc/4.9.2 openmpi/1.8.2 hdf5/1.8.14
module use deprecated; module load gcc/4.9.2 openmpi/1.8.4 hdf5/1.8.14

Use verbosity level warn to suppress the hints:

$ module load hdf5/1.8.14 --warn
module load: module unavailable -- hdf5/1.8.14

Loading an unstable module:

$ module use unstable
$ module load cmake/3.1.3
Warning: the unstable module 'cmake/3.1.3' has been loaded.

To supress the warning, use the --silent option.

EXAMPLES (rm|unload)
$ module list
Currently Loaded Modulefiles:
  1) gcc/4.9.2       2) openmpi/1.8.4   3) hdf5/1.8.14
$ module rm openmpi/1.8.4
$ module list
Currently Loaded Modulefiles:
  1) gcc/4.9.2

The module hdf5/1.8.14 is unloaded as a dependency of openmpi/1.8.4.

3.2.8. Purge all loaded modules

NAME

module purge - purge all loaded modules

SYNOPSIS

module purge

DESCRIPTION

Unload all loaded module and reset everything to original state.

EXAMPLES

List loaded modules:

$ module list
Currently Loaded Modulefiles:
  1) gcc/4.8.3       2) openmpi/1.8.2   3) gnuplot/4.6.3

Now we purge everything and list the loaded modules again:

$ module purge
$ module list
No Modulefiles Currently Loaded.

3.2.9. Refresh loaded modules

NAME

module refresh - refresh loaded modules

SYNOPSIS

module refresh

DESCRIPTION

Force a refresh of all non-persistent components of currently loaded modules. This should be used on derived shells where aliases need to be reinitialized but the environment variables have already been set by the currently loaded modules.

NAME

module search - search installed modules

SYNOPSIS

module search [switches] string…​

DESCRIPTION

List all modules in the current MODULEPATH and the module hierarchy. If an argument is given, search for modules whose name match the argument. Options

OPTIONS
--no-header

Suppress output of a header.

--release=RELEASE

Search for modules within this release. You can specify this switch multiple times. Without this switch, the used releases will be searched.

-a|--all-releases

Search within all releases.

--with=STRING

Search for modules compiled with modules matching string. The command. See example below.

--src=dir

Search module hierarchy in dir. Eine Textbeschreibung der Funktionsweise des Befehls oder der Funktion. (Üblicherweise jedoch nicht der Benutzung, siehe unten.)

EXAMPLES

Get list of all installed GCC:

$ module search --all-releases gcc
Module               Release    Group        Requires
------------------------------------------------------------
gcc/4.7.4            stable     Programming
gcc/4.8.2            stable     Programming
gcc/4.8.3            stable     Programming
gcc/4.8.4            stable     Programming
gcc/4.8.5            stable     Programming
gcc/4.9.2            stable     Programming
gcc/4.9.3            stable     Programming
gcc/4.9.4            stable     Programming
gcc/5.1.0            deprecated Programming
gcc/5.2.0            deprecated Programming
gcc/5.3.0            stable     Programming
gcc/5.4.0            stable     Programming
gcc/6.1.0            stable     Programming
gcc/6.2.0            stable     Programming
gcc/6.3.0            stable     Programming
gcc/6.4.0            stable     Programming
gcc/7.1.0            stable     Programming
gcc/7.2.0            stable     Programming

Get list of all open-mpi versions compiled with GCC 5.4.0:

$ module search --all-releases openmpi --with=gcc/5.4.0
Module               Release    Group        Requires
------------------------------------------------------------
openmpi/1.10.2       stable     Compiler     gcc/5.4.0
openmpi/1.10.4       stable     Compiler     gcc/5.4.0
openmpi/2.0.1        stable     Compiler     gcc/5.4.0
SEE ALSO

3.2.11. Swapping modules

NAME

module swap|switch - replace a loaded module by another

SYNOPSIS

module swap [modulefile1] modulefile2
module switch [modulefile1] modulefile2

DESCRIPTION

Switch loaded modulefile1 with modulefile2. If modulefile1 is not specified, then it is assumed to be the currently loaded module with the same root name as modulefile2.

OPTIONS / FLAGS

None

EXAMPLES
$ module load gcc/4.8.4
$ module swap gcc/4.9.2
$ module list
Currently Loaded Modulefiles:
  1) gcc/4.9.2
BUGS

You can only swap between different version. The following commands are working (assuming that gcc/4.8.2 is loaded):

$ module swap gcc/4.9.2
$ module swap gcc/4.9.2 gcc/5.4.0

The following command does not working as expected:

$ module swap gcc/4.8.2 intel/15.0

This command does not work with the Tcl implementation (environment variable PMOUDLE_PURETCL set).

3.2.12. Manipulate module path, used releases, groups or overlays

NAME

module use|unuse - manipulate module path, used releases or groups

SYNOPSIS

module use [OPTIONS] [string…​]

module unuse string…​

DESCRIPTION

If called without arguments, print a summary about used groups, releases and additional directories in MODULEPATH.

If string is a directory, append, prepend or remove this directory to/from MODULEPATH.

If string is a group name, append, prepend or remove the corresponding directory to/from MODULEPATH.

If string is a releases name, make all modules with this release available/unavailable. Known releases are;

stable

Modules released as stable are considered to be production ready. The files of a stable module will never change.

unstable

These modules are still unstable. They may not be ready for production use. The files of unstable modules may change to fix bugs or add functionality. Use at your own risk.

deprecated

Deprecated modules should not be used any more and may be removed without further notice.

If string matches flag=[-_a-zA-Z0-9]* the RHS will be interpreted as use-flag.

OPTIONS / FLAGS
-a | --append

append directory or group to MODULEPATH.

-p | --prepend

prepend directory or group to MODULEPATH.

EXAMPLES

List used/unused groups, releases and additional directories in MODULEPATH:

$ module use
Used groups:
	Tools
	Programming
	Compiler

Unused groups:
	Legacy
	Libraries
	System

Used releases:
	stable
	unstable

Unused releases:
	deprecated

Used flags:
	omp

Additonal directories in MODULEPATH:
	none

Adding the 'System' group

$ module use System
$ module avail
-------------------------------------------- System:  --------------------------------------------

filebench/1.4.9.1               fsstress/1.0.0  nmap/6.46       patchelf/0.8.1

-------------------------------------------- Tools:  --------------------------------------------

ANSYS/18.2      emacs/24.4      git/2.3.3       global/6.3.1    gnuplot/4.6.3   gnuplot/5.0.0
...

----------------------------------------- Programming:  -----------------------------------------

autoconf/2.69   automake/1.14   automake/1.15   binutils/2.25   cmake/2.8.12.2  cmake/3.1.3
cmake/3.6.3     gcc/4.7.4       gcc/4.8.3       gcc/4.8.4       gcc/4.9.2       gcc/4.8.5
...

Adding a directory to MODULEPATH

$ module use /afs/psi.ch/project/amas/modulefiles
$ module avail
----------------------------------- /afs/psi.ch/project/amas:  -----------------------------------

H5hut_parallel-toolchain/2.0    H5hut_serial-toolchain/2.0      OPAL/1.6        OPAL/1.6.0rc5
opal-toolschain/1.6             opal-toolschain/2.0

-------------------------------------------- Tools:  --------------------------------------------

ANSYS/18.2      emacs/24.4      git/2.3.3       global/6.3.1    gnuplot/4.6.3   gnuplot/5.0.0
...
----------------------------------------- Programming:  -----------------------------------------

autoconf/2.69   automake/1.14   automake/1.15   binutils/2.25   cmake/2.8.12.2  cmake/3.1.3
cmake/3.6.3     gcc/4.7.4       gcc/4.8.3       gcc/4.8.4       gcc/4.9.2       gcc/4.8.5
...
$ module unuse /afs/psi.ch/project/amas/modulefiles
$ module unuse System
$ module unuse unstable

3.2.13. Show/search 'what is' information

NAME

module whatis - print one-line information about module module keyword|apropos - search for keywords in 'whatis'

SYNOPSIS

module whatis [module…​]
module apropos string…​
module keyword string…​

DESCRIPTION
whatis

Display the information set up by the module-whatis commands inside the specified modulefile(s). If no modulefile is specified, all whatis lines will be shown.

keyword|apropos

Search through the 'whatis' informations of all modulefiles for the specified string. All whatis informations matching the string will be displayed.

EXAMPLES

Get whatis for all available Git modules

$ module  whatis git
----------- /opt/psi/Tools/modulefiles -------------
           git/2.3.3: distributed version control system
           git/2.5.2: distributed version control system
           git/2.8.1: distributed version control system
          git/2.11.1: distributed version control system
----------- /opt/psi/Programming/modulefiles -------------
SEE ALSO