Modules (Lmod)
Another way to manage your user environment is through environment modules. With a module system, you select which packages, software, and compilers are loaded or active, which consequently affects your environment variables and what commands you are able to perform. The TACC Lmod Environmental Modules System is a software system designed for exactly this purpose.
Lmod provides a convenient set of commands to set up a user's environment dynamically through modulefiles prepared especially for a given system like Vista. By loading a module, the corresponding pre-built package is made active by changing the values of variables such as $PATH. Any package-specific environment variables are also set to appropriate values.
Whatever changes are made by loading a module can be reversed cleanly and without errors by unloading the module. Moreover, Lmod guarantees that the whole group of packages that are currently loaded are consistent and compatible with each other. This removes much of the burden of application installation, configuration, and management from the user.
Lmod has been incorporated into OpenHPC and as a result is present on many High Performance Computing (HPC) systems. A complete guide to the Lmod system is the User Guide for Lmod, which is recommended as background reading if you have not used modules before. Here we will cover an abbreviated set of commands for reference.
Basic Commands
| Command | Description |
|---|---|
module list |
List all modules currently loaded |
module avail |
Show which modules are available to be loaded |
module reset |
Return to initial, default set of modules loaded |
module load <package> |
Load a package |
module unload <package> |
Unload a package |
module swap <package1> <package2> |
Change from <package1> to <package2> loaded |
module help <package> |
Access help for a modulefile |
module whatis <package> |
Show a description of the module |
module spider |
List all modules, even those not available to load |
module spider <package> |
List more details about a package |
The above commands can be shortened to just enough letters to make it clear which one is intended, e.g., module av. Also, a package name can include a specific version number; omitting the version number may result in a default version being loaded or result in an error. If you do encounter an error, check if the module exists with module spider. For example, to ensure you are loading version 15.1.0 of the GNU Compiler Collection, you would enter
The module command also provides modulefile name completion, similar to the bash shell. For example, by hitting the tab key after entering "15.1" in the above command, the modulefile name will be completed with ".0" (unless that module is already loaded). If tab completion does not occur because multiple valid names exist, hitting tab twice more will list all the possible completions of the command.
The ml Command
The ml command is a shorthand command to several Lmod commands, and usage determines which command is executed. Below are a few examples of usage.
To run a module list, simply enter:
To load <package>:
$ ml <package>
To unload <package>:
$ ml -<package>
Please note that there is no man page for the ml command because it is implemented as a bash function via the shell environment. To get help with the command, execute ml --help.
Loading Modules from TACC Training
CVW material development is supported by NSF OAC awards 1854828, 2321040, 2323116 (UT Austin) and 2005506 (Indiana University)