User Tools

Site Tools


hpc:lmod

This is an old revision of the document!


Install LMOD

Lmod is a Lua-based module system that easily handles the MODULEPATH Hierarchical problem. 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. Modulefiles for Library packages provide environment variables that specify where the library and header files can be found.

LMOD provides a convenient way to dynamically change a user's 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 path to make access easy. Modulefiles for Library packages provide environment variables that specify where the library and header files can be found. It is also very easy to switch between different versions of a package or remove the package.

Packages can be loaded and unloaded cleanly through the module system. All the popular shells are supported: bash, ksh, csh, tcsh, zsh. LMOD is also available for perl and python.

Official website: https://www.tacc.utexas.edu/research-development/tacc-projects/lmod

Install

The goal of installing Lmod is when completed, any user will have the module command defined and a preset list of modules will be loaded. The module command should work without modifying the users startup files (~/.bashrc, ~/.profile, ~/.cshrc, or ~/.zshenv). The module command should be available for login shells, interactive shells, and non-interactive shells. The command ssh YOUR_HOST module list should work. This will require some understanding of the system startup procedure for various shells which is covered here.

Install dependencies

In CentOS may require looking the EPEL repo. At TACC we install the following rpms

yum install  lua-bitop  lua-filesystem  lua-json lua-lpeg lua-posix lua-term tcl tcl-devel

Install Lmod

Download the last version of Lmod

wget https://phoenixnap.dl.sourceforge.net/project/lmod/Lmod-8.2.tar.bz2
bunzip2 Lmod-8.2.tar.bz2
tar -xf Lmod-8.2.tar
cd Lmod-8.2
./configure --prefix=/opt/apps/
make install 

The installation will also create a link to /apps/lmod/lmod. The symbolic link is created to ease upgrades to Lmod itself, as numbered versions can be installed side-by-side, testing can be done on the new version, and when all is ready, only the symbolic link needs changing.

To create such a testing installation, you can use:

make pre-install

In the init directory of the source code, there are profile.in and cshrc.in templates. During the installation phase, the path to lua is added and profile and cshrc are written to the /apps/lmod/lmod/init directory. These files are created assuming that your modulefiles are going to be located in /apps/modulefiles/$LMOD_sys and /apps/modulefiles/Core, where $LMOD_sys is what the command “uname” reports, (e.g., Linux, Darwin).

You need edit files /opt/apps/lmod/lmod/init/profile and /opt/apps/lmod/lmod/init/cshrc and change the variable MODULEPATH_ROOT

setenv MODULEPATH_ROOT      "/opt/apps/lmod/lmod/modulefiles"

The profile file is the Lmod initialization script for the bash and zsh shells, the cshrc file is for tcsh and csh shells, and the profile.fish file is for the fish shell. Please copy or link the profile and cshrc files to /etc/profile.d, and optionally the fish file to /etc/fish/conf.d:

ln -s /opt/apps/lmod/lmod/init/profile        /etc/profile.d/z00_lmod.sh
ln -s /opt/apps/lmod/lmod/init/cshrc          /etc/profile.d/z00_lmod.csh

To test the setup, you just need to login as a user. The module command should be set and MODULEPATH should be defined. Bash or Zsh users should see something like:

<code> module avail </code

hpc/lmod.1580769311.txt.gz · Last modified: 2020/04/10 17:38 (external edit)