Environment Modules Documentation

The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. Modules can be loaded and unloaded dynamically and atomically, in a clean fashion. All popular shells are supported, including bash, ksh, zsh, sh, csh, tcsh, as well as some scripting languages such as perl.

Modules helps to maintain multiple versions of the same software and lets user load/unload required version dynamically into their environment.

Now to some examples.

user@computenode:~> module --help

  Modules Release 3.2.6 2007-02-14 (Copyright GNU GPL v2 1991):

  Usage: module [ switches ] [ subcommand ] [subcommand-args ]

Switches:
        -H|--help               this usage info
        -V|--version            modules version & configuration options
        -f|--force              force active dependency resolution
        -t|--terse              terse    format avail and list format
        -l|--long               long     format avail and list format
        -h|--human              readable format avail and list format
        -v|--verbose            enable  verbose messages
        -s|--silent             disable verbose messages
        -c|--create             create caches for avail and apropos
        -i|--icase              case insensitive
        -u|--userlvl <lvl>      set user level to (nov[ice],exp[ert],adv[anced])
  Available SubCommands and Args:
        + add|load              modulefile [modulefile ...]
        + rm|unload             modulefile [modulefile ...]
        + switch|swap           [modulefile1] modulefile2
        + display|show          modulefile [modulefile ...]
        + avail                 [modulefile [modulefile ...]]
        + use [-a|--append]     dir [dir ...]
        + unuse                 dir [dir ...]
        + update
        + refresh
        + purge
        + list
        + clear
        + help                  [modulefile [modulefile ...]]
        + whatis                [modulefile [modulefile ...]]
        + apropos|keyword       string
        + initadd               modulefile [modulefile ...]
        + initprepend           modulefile [modulefile ...]
        + initrm                modulefile [modulefile ...]
        + initswitch            modulefile1 modulefile2
        + initlist
        + initclear

"module --help" displays all the options that can be passed to the module command

user@computenode:~> module -l avail
- Package -----------------------------+- Versions -+- Last mod. ------
/usr/local/Modules/versions:
3.2.6                                                2008/02/04 17:21:09

/usr/local/Modules/3.2.6/modulefiles:
AFNI/20091231                                        2010/03/12  5:09:14
CASAVA/1008                                          2010/06/21 15:02:03
CASAVA/1010                                          2010/06/21 15:02:03
CASAVA/1600                                          2010/06/21 15:03:04
CASAVA/1700                                          2010/07/21 13:38:49
...

So, "module avail" shows all the available modules in the system. Above, you can see that multiple versions of CASAVA are available for the user to work with. If a user did "module load CASAVA", CASAVA version 1.7 (latest version) will be loaded in his environment by default.

user@computenode:~> module whatis torque
torque               : adds Torque to your environment variables

"module whatis <modulename>" gives a short description of what a specific module file does.

user@computenode:~> module list
Currently Loaded Modulefiles:
 1) modules/3.2.6   2) torque/2.3.6    3) pbstools/1.4    4) c3/4            5) moab/5.3.1      6) gold/2200
user@computenode:~> which qstat
/usr/local/torque-2.3.6/bin/qstat
user@computenode:~>

"module list" shows all the currently loaded modules in your environment. You can see that "qstat" is available within Torque and the PATH is automatically added to your environment by modules.

user@computenode:~> module display torque
-------------------------------------------------------------------
/usr/local/Modules/3.2.6/modulefiles/torque/2.3.6:

module-whatis    adds Torque to your environment variables
setenv           PBSHOME /usr/local/torque-2.3.6
prepend-path     PATH /usr/local/torque-2.3.6/bin
prepend-path     LD_LIBRARY_PATH /usr/local/torque-2.3.6/lib
prepend-path     MANPATH /usr/local/torque-2.3.6/man
setenv           PBS_SERVER_HOME /var/spool/torque-2.3.6
-------------------------------------------------------------------

"module display <modulename>" displays detailed information on what environment variables this module file changes/modifies.

user@computenode:~> module rm torque
user@computenode:~> which qstat
which: no qstat in (/usr/local/gold/2.2.0.0/bin:/usr/local/moab-5.3.1/bin:/usr/local/moab-5.3.1/sbin:
/usr/local/c3-4:/usr/local/pbstools-1.4/bin:/users/user/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:
/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/NX/bin:.:/usr/lib/mit/bin:
/usr/lib/mit/sbin:/usr/NX/bin:.)

"module rm <modulename>" removes the module from your environment. Hence you can see above that qstat is not known now as the Torque's PATH has been removed from your environment.

user@computenode:~> module list
Currently Loaded Modulefiles:

 1) modules/3.2.6   2) pbstools/1.4    3) c3/4            4) moab/5.3.1      5) gold/2200       6) torque/2.3.6
user@computenode:~> module purge
user@computenode:~> module list
No Modulefiles Currently Loaded.

Finally, "module purge" removes all the loaded modules from your environment.

not-front not-logged-in node-type-page one-sidebar sidebar-right page-resources-software-environment-modules-documentation section-resources page-resources-software-environment-modules-documentation section-resources taxonomy-software