Environment Modules (software) explained

Environment Modules
Latest Release Version:5.4.0
Operating System:Unix-like
License:GNU General Public License#Version 2

The Environment Modules system is a tool to help users manage their Unix or Linux shell environment, by allowing groups of related environment-variable settings to be made or removed dynamically.

Modules has been around since the early 1990s[1] and is used at some of the largest computer centers[2] to deploy multiple versions of different software tools to users. The National Energy Research Scientific Computing Center (NERSC) reports that they use Environment Modules to manage nearly all software.[3] Environment Modules is specified as a Baseline Configuration requirement of the DoD High Performance Computing Modernization Program (HPCMP)[4] Project Baseline Configuration[5] team for participating DoD Supercomputing Resource Centers (DSRCs).

modulefiles

The modules system is based on modulefiles,[6] which specify groups of environment settings that need to be made together. Modulefiles can be installed in a central location for general use, or in a user directory for personal use. Environment Modules modulefiles are written in the Tcl (Tool Command Language) and are interpreted by the modulecmd program via the module[7] user interface.

The key advantage of Environment Modules is that it is shell independent and supports all major shells such as bash, ksh, zsh, sh, tcsh, and csh. The second key advantage is that it allows to use multiple versions of the program or package from the same account by just loading proper module. Those two advantages were instrumental in making Environment Modules a part of most HPC cluster setups. It also inspired several alternative implementation such as lmod from University of Texas, which is written in Lua instead of TCL.

modulefiles are created on per application per version basis. They can be dynamically loaded, unloaded, or switched. Along with the capability of using multiple versions of the same software it also can be used to implement site policies regarding the access and use of applications.

Default modulefiles directory

The default modules search path is in a hidden configuration file you can display with:The directory used by some distributions (or any other directory) can be used after a build from source by modifying the file.

Add your own modules to the path

The module essentially performs these steps:

Use a version file within a hierarchical organization

The commands in this section require read/write/execute access to the /etc/modulefiles directory. The $HOME/privatemodules or another directory can be used instead along with "module use --append" or modification of the configuration file specifying the default modules search path.

The default modulefiles directory is empty initially. Copy the null module to the default modulefiles directory to have it shown by "module avail". The following uses the null and module-info modules to show use of a version file within a hierarchical organization and their effect on module avail and module show: mkdir /etc/modulefiles/test cp $/modulefiles/null /etc/modulefiles/test/2.0 cp $/modulefiles/module-info /etc/modulefiles/test/1.0 module avail module show testSet the first version as the default: echo '#%Module' > /etc/modulefiles/test/.version echo 'set ModulesVersion "1.0"' >> /etc/modulefiles/test/.version module avail module show test module show test/2.0Switch to the newer version as the default with: rm /etc/modulefiles/test/.version echo '#%Module' > /etc/modulefiles/test/.version echo 'set ModulesVersion "2.0"' >> /etc/modulefiles/test/.version module avail module show testAfter the above following a fresh install from source you would see:$ module avail

-------------------- /usr/local/Modules/3.2.10/modulefiles ---------------------dot module-git module-info modules null use.own

------------------------------- /etc/modulefiles -------------------------------null test/1.0 test/2.0(default)

--------------------------- /home/user/privatemodules --------------------------null

$ module show test-------------------------------------------------------------------/etc/modulefiles/test/2.0:

module-whatis does absolutely nothing -------------------------------------------------------------------

$ module show test/1.0-------------------------------------------------------------------/etc/modulefiles/test/1.0:

module-whatis returns all various module-info values +++ module-info +++++++++++++++++++++++++++++++flags = 2mode = displayname = test/1.0specified = test/1.0shell = bashshelltype = shversion = test/1.0user = advancedtrace = 0tracepat = -.*symbols = *undef*+++ info ++++++++++++++++++++++++++++++++++++++hostname = localhostlevel = 1loaded null = 0library = /usr/local/lib/tcl8.6nameofexecutable =sharedlibextension = .sotclversion = 8.6patchlevel = 8.6.1+++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------------------------------------

Automatic modules initialization

Environment Modules on Scientific Linux, CentOS, and RHEL distributions in the environment-modules package include and scripts for the directory that make modules initialization part of the default shell initialization. One of the advantages of Environment Modules is a single modulefile that supports bash, ksh, zsh, sh as well as tcsh and csh shell users for environment setup and initialization. This makes managing complex environments a bit less complicated.

For a source build the automation for all users can be manually configured.

bash, ksh, zsh, sh automatic modules initialization

from the file in the 3.2.10 modules build directory. trap "" 1 2 3 case "$0" in -bash|bash|*/bash) . /usr/local/Modules/default/init/bash ;; -ksh|ksh|*/ksh) . /usr/local/Modules/default/init/ksh ;; -zsh|zsh|*/zsh) . /usr/local/Modules/default/init/zsh ;; *) . /usr/local/Modules/default/init/sh ;; # default esac trap 1 2 3Copy the file from the 3.2.10 modules build directory to the system initialization directory:$ sudo cp etc/global/profile.modules /etc/profile.d/modules.shAdd a version 3.2.10 symbolic link for the above generic addresses:$ cd /usr/local/Modules$ sudo ln -sT 3.2.10 default

tcsh, csh automatic modules initialization

A symbolic link to the file in the 3.2.10 modules build directory can enable automatic modules initialization for these users.

Installing on Linux

Installing Environment Modules on Linux using yum and rpm

On Scientific Linux, CentOS, and RHEL distributions Environment Modules is in the environment-modules package which can be installed with: sudo yum install environment-modules

Once installed the package information can be viewed with: rpm -qi environment-modules rpm -ql environment-modules

Installing Environment Modules on Linux using apt and dpkg

On Ubuntu or systems using apt-get, Environment Modules can be installed with: sudo apt-get install environment-modules

Once installed the package information can be viewed with: dpkg -L environment-modules

Installing Environment Modules on Linux from source

Although installing from a Linux distributions repository using that distributions update manager is the easiest the software can be installed from source. Resolve dependencies is the most difficult task for an installation from source. The typical configure, make, install cycle can become painfully slow as each configure improvement reveals another dependency not available in your default environment. This section includes the steps to install the Environment Modules package on source including compiling the Tcl (Tool Command Language) from source as a dependency.

8.6.1 version of Tcl (Tool Command Language) built from /usr/local/src

Although the PCLinuxOS 64-bit repositories include Tcl (Tool Command Language) they do not include a development package with the configuration files required to build Environment Modules on Linux from source. Building Tcl from source will make the required files available.

Tcl Source: http://sourceforge.net/projects/tcl/files/Tcl/

Extract source after downloadingConfigure, make, install

3.2.10 version of modules built from /usr/local/src

Extract source after downloadingConfigure, make, install

See also

External links

  1. http://modules.sourceforge.net/ - home page for the Environment Modules project
  2. John L. Furlani, Modules: Providing a Flexible User Environment Proceedings of the Fifth Large Installation Systems Administration Conference (LISA V), pp. 141–152, San Diego, CA, September 30 - October 3, 1991.
  3. http://lmod.sourceforge.net - alternative implementation using LUA instead of Tcl
  4. http://www.lysator.liu.se/cmod/ - alternative implementation using C only
  5. PennState Environment Modules User Guide
  6. Drag your design environment kicking and screaming into the '90s with Modules! - SNUB Boston 2001 - Erich Whitney, Axiowave Networks, Mark Sprague, ATI Research

Notes and References

  1. Furlani . John L. . September 30 – October 3, 1991 . Modules: Providing a Flexible User Environment . Proceedings of the Fifth Large Installation Systems Administration Conference (LISA V) . San Diego, CA . 141–152 . 9 February 2014.
  2. Web site: NICS User Support Kraken Modules Description . 22 May 2011 . The National Institute for Computational Sciences (NICS) . Oak Ridge National Laboratory - Department of Energy . 9 February 2014 . dead . https://web.archive.org/web/20140222062335/http://www.nics.tennessee.edu/computing-resources/kraken/modules . 22 February 2014 .
  3. Web site: NERSC Modules Software Environment . . 2014-02-07 . The National Energy Research Scientific Computing Center (NERSC) . Office of Science - Department of Energy . 19 February 2014.
  4. Web site: Use of Modules for Accessing Multiple Versions of Software . 20 Mar 2008 . Baseline Configuration . DoD High Performance Computing Modernization Program (HPCMP) . 9 February 2014 . dead . https://web.archive.org/web/20140222063501/http://centers.hpc.mil/consolidated/bc/policies.php?choice=modules . 22 February 2014 .
  5. Web site: DoD High Performance Computing Modernization Program Baseline Configuration . Baseline Configuration . DoD High Performance Computing Modernization Program (HPCMP) . 9 February 2014 . dead . https://web.archive.org/web/20140222063504/http://centers.hpc.mil/consolidated/bc/index.php . 22 February 2014 .
  6. Web site: modulefile - files containing Tcl code for the Modules package . John L. Furlani & Peter W. Osel . July 2009 . SourceForge . man page . 9 February 2014.
  7. Web site: module - command interface to the Modules package . John L. Furlani & Peter W. Osel . July 2009 . SourceForge . man page . 9 February 2014.