Submitted Successfully!
To reward your contribution, here is a gift for you: A free trial for our video production service.
Thank you for your contribution! You can also upload a video entry or images related to this topic.
Version Summary Created by Modification Content Size Created at Operation
1 handwiki -- 1237 2022-12-01 01:44:36

Video Upload Options

Do you have a full video?

Confirm

Are you sure to Delete?
Cite
If you have any further questions, please contact Encyclopedia Editorial Office.
HandWiki. Environment Modules. Encyclopedia. Available online: https://encyclopedia.pub/entry/37466 (accessed on 18 April 2024).
HandWiki. Environment Modules. Encyclopedia. Available at: https://encyclopedia.pub/entry/37466. Accessed April 18, 2024.
HandWiki. "Environment Modules" Encyclopedia, https://encyclopedia.pub/entry/37466 (accessed April 18, 2024).
HandWiki. (2022, December 01). Environment Modules. In Encyclopedia. https://encyclopedia.pub/entry/37466
HandWiki. "Environment Modules." Encyclopedia. Web. 01 December, 2022.
Environment Modules
Edit

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 and is used at some of the largest computer centers 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. Environment Modules is specified as a Baseline Configuration requirement of the DoD High Performance Computing Modernization Program (HPCMP) Project Baseline Configuration team for participating DoD Supercomputing Resource Centers (DSRCs).

unix nersc hpcmp

1. Modulefiles

The modules system is based on modulefiles,[1] 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[2] 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.

1.1. Default Modulefiles Directory

The default modules search path is in a hidden configuration file you can display with:

$ cat ${MODULESHOME}/init/.modulespath /etc/modulefiles # CentOS, Scientific Linux, RHEL /usr/local/Modules/modulefiles # Build from source default

The /etc/modulefiles directory used by some distributions (or any other directory) can be used after a build from source by modifying the ${MODULESHOME}/init/.modulespath file.

1.2. Add Your Own Modules to the Path

The ${MODULESHOME}/modulefiles/use.own module essentially performs these steps:

mkdir $HOME/privatemodules cp ${MODULESHOME}/modulefiles/null $HOME/privatemodules module use --append $HOME/privatemodules

1.3. 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 ${MODULESHOME}/modulefiles/null /etc/modulefiles/test/2.0 cp ${MODULESHOME}/modulefiles/module-info /etc/modulefiles/test/1.0 module avail module show test

Set 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.0

Switch 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 test

After 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 = 2 mode = display name = test/1.0 specified = test/1.0 shell = bash shelltype = sh version = test/1.0 user = advanced trace = 0 tracepat = -.* symbols = *undef* +++ info ++++++++++++++++++++++++++++++++++++++ hostname = localhost level = 1 loaded null = 0 library = /usr/local/lib/tcl8.6 nameofexecutable = sharedlibextension = .so tclversion = 8.6 patchlevel = 8.6.1 +++++++++++++++++++++++++++++++++++++++++++++++ -------------------------------------------------------------------

2. Automatic Modules Initialization

Environment Modules on Scientific Linux, CentOS, and RHEL distributions in the environment-modules package include modules.csh and modules.sh scripts for the /etc/profile.d 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.

2.1. Bash, Ksh, Zsh, Sh Automatic Modules Initialization

/etc/profile.d/modules.sh from the etc/global/profile.modules 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 3

Copy the etc/global/profile.modules file from the 3.2.10 modules build directory to the system initialization directory:

$ sudo cp etc/global/profile.modules /etc/profile.d/modules.sh

Add a version 3.2.10 symbolic link for the above generic addresses:

$ cd /usr/local/Modules $ sudo ln -sT 3.2.10 default

2.2. Tcsh, Csh Automatic Modules Initialization

A /etc/profile.d/modules.csh symbolic link to the etc/global/profile.modules file in the 3.2.10 modules build directory can enable automatic modules initialization for these users.

3. Installing on Linux

3.1. 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 

3.2. 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 

3.3. 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.

  • Installing Environment Modules

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 downloading

cd /usr/local/src tar -xvzf ~/Downloads/tcl8.6.1-src.tar.gz

Configure, make, install

cd /usr/local/src/tcl8.6.1 unix/configure make sudo make install

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

Extract source after downloading

cd /usr/local/src tar -xvzf ~/Downloads/modules-3.2.10.tar.gz

Configure, make, install

cd /usr/local/src/modules-3.2.10 CPPFLAGS="-DUSE_INTERP_ERRORLINE" ./configure make sudo make install

References

  1. John L. Furlani & Peter W. Osel (July 2009). "modulefile - files containing Tcl code for the Modules package". man page. http://modules.sourceforge.net/man/modulefile.html. 
  2. John L. Furlani & Peter W. Osel (July 2009). "module - command interface to the Modules package". man page. http://modules.sourceforge.net/man/module.html. 
More
Information
Contributor MDPI registered users' name will be linked to their SciProfiles pages. To register with us, please refer to https://encyclopedia.pub/register :
View Times: 336
Entry Collection: HandWiki
Revision: 1 time (View History)
Update Date: 01 Dec 2022
1000/1000