Skip to main content

Modules

Modules are a method of modifying your environment that are unique to some software you're trying to run. It allows you to quickly switch between different programs or different versions of the same program. Both Klone and Tillicum use LMOD for module management, but with some differences in how modules are organized.

Basics

What software is available?

module avail

What modules do I currently have loaded?

module list

How to (un)load a software?

Replace "software" below with a specific module you know exists or identified via module avail above.

module load <software>

Conversely, you can unload a specific module.

module unload <software>

You can unload every module you might have loaded.

module purge

Command Summary

CommandDescription
module listList active modules in the current session
module availList available modules in MODULEPATH
module spider [module]Search all modules in MODULEPATH and every module hierarchy
module load [modules]Load modules
module swap [module1] [module2]Replace module1 with module2
module unload [modules]Unload specific modules
module purgeUnload ALL modules from the current session
module show [module]Show functions performed by loading module
module help [module]Show module-specific help message
module use [-a] [path]Prepend or append path to MODULEPATH

Lmod provides a convenient shortcut command ml for the module command.

tip

ml can be used instead of module, module load, or module list depending on the situation.

ExampleEquivalent
mlmodule list
ml [module]module load [module]
ml -[module]module unload [module]
ml availmodule avail
tip

The Hyak team encourages the use of Apptainer to better promote computational portability and reproducibility. You can read more about Apptainer here.


Module Structure

Select your system

Hyak Klone and Tillicum handle modules differently. Use the tabs below to view instructions for the system you're working on. Your selection applies to the entire page.

Klone uses a flat module structure. The Hyak team maintains most core modules for building software, including GNU compilers (e.g., gcc, g++, gfortran) or their Intel compiler equivalents as well as select MPI libraries.

There is a larger list of modules maintained by the broader Hyak community that appears when you run module avail. Community created or "contrib" modules are provided as is. Community modules on Klone are separated into a lower section and within the lower section each module is further prefixed by the respective group that created the module. Not all contributed modules are publicly available.

Login vs Compute Node

Modules are meant to be set up for programs used in intensive computing; they should only be loaded on compute nodes. To reinforce this point the module command does not exist on the login nodes. If you try to run the module command you will receive a warning message. This warning is benign and you can even disable it if you have modules loading in your start up shell file (e.g., .bashrc, .zshrc).

If you wanted to be more discerning, the logic is useful to include in your start up shell file for identifying if the host is a login node:

export LOGIN_NODE=$(hostname | grep -q '^klone1' ; echo $?)

if [[ $LOGIN_NODE ]]
then
echo "This is a login node"
else
echo "This is a compute node"
fi

Creating Custom Modules

Personal LMOD Modules

This advanced user documentation from the LMOD developers walks you through creating personal modules. You need to compile your code separately first. In short, you provide a command directing it to the folder with your collection of module files:

module use /path/to/personal/modulefiles

In this case you'll likely use a sub-directory under your lab's /gscratch folder or your home directory and create individual folders with independent software packages. Once you have code compiled, a modulefile needs to be created for each software package you installed. There are some examples from basic to advanced here.

Shared LMOD Modules

Each group has a special folder for installing codes that are intended to be shared for all Klone users. Each folder gets a 100GB block quota and 160,000 inode quota at /sw/contrib/mylab-src where "mylab" is your account affiliation. We can raise these limits if specific code compiles require, however, in our experience the default quotas are sufficient for all but the most rare cases.

You place your modulefiles in /sw/contrib/modulefiles/mylab and when anyone runs module avail it will now appear in the "contrib" section in the lower half. Note the prefix is automatically tagged to your group name.


Additional Resources