Modules Basic Usage¶
Tip
Running just module
will output help information on the module system. The module
help includes all information described below. You can also view the
User Guide to Lmod
for the upstream documentation.
Loading a module¶
If you already know the name of the module, the only command needed to load the latest or the default version of the module and be able to execute the software is module load application_name
. For instance, if the module is called ncbi_blast
, run:
module load ncbi_blast
Why modules?¶
With thousands of applications and versions installed, each has its own set of conflicting dependencies. It would be impossible if we simply installed everything and added all applications to user's execution paths.
The environment modules system allows us to install many applications and also maintain multiple versions of those applications while avoiding the conflicts among them.
What applications are available using the module system?¶
All applications that Research Computing installed for users, as well as most compilers, libraries and programming languages are accessed using the module system. There is a list of installed applications here.
How do I load a module?¶
The module load
command loads the module. For example, for python:
module load python
As another example, note that before the python module is loaded, the python path points to the system python install (at /usr/bin/python
), while after loading, a UFIT-RC maintained version is used (at /apps/python/3.10/bin/python
):
[username@login10 ~]$ which python
/usr/bin/python
[username@login10 ~]$ module load python
[username@login10 ~]$ which python
/apps/python/3.10/bin/python
[username@login10 ~]$
Modules are typically named with the lowercase version of the application name. There are some exceptions (e.g. the R module is loaded with module load R
).
How do I specify a particular module version?¶
Typically, the module load
command will load the highest numbered version (there are some cases, where we set default versions). If you want a specific version, you can add the version number after the module name: e.g.
module load R/4.1
To ensure reproducibility by using a consistent version of an application, it is best to add the version number. Otherwise, when a newer version is installed, that new version would be used, potentially changing an application's behavior. Be sure to check periodically for new versions and decide when to change the version used.
How can I show information about a module?¶
module whatis app
shows info about a module such as name, version, category, upstream url, and a short description.module spider app/version
shows a longer description and information on what versions are available, as well as what other modules have to be loaded first.module list
shows all modules you currently have active (loaded).
How can I discover modules?¶
Search with module spider
¶
When you need to find out whether a program is already installed user
either module spider
to search through the module names.
Expand to see an example of the module spider amber
output
[username@login10 ~]$ module spider amber
-----------------------------------------------------------------------------------------------
amber:
-----------------------------------------------------------------------------------------------
Description:
Assisted Model Building with Energy Refinement
Versions:
amber/14
amber/16.0
amber/18
amber/20
amber/22
amber/24
Other possible modules matches:
7.3.0/amber ambertools
-----------------------------------------------------------------------------------------------
To find other possible module matches execute:
$ module -r spider '.*amber.*'
-----------------------------------------------------------------------------------------------
For detailed information about a specific "amber" package (including how to load the modules) use the module's full name.
Note that names that have a trailing (E) are extensions provided by other modules.
For example:
$ module spider amber/24
-----------------------------------------------------------------------------------------------
Adding a version number will provide additional details, like other modules that need to be loaded to use a given module.
Expand to see an example of the module spider amber/24
output
[magitz@login10 ~]$ module spider amber/24
-----------------------------------------------------------------------------------------------
amber: amber/24
-----------------------------------------------------------------------------------------------
Description:
Assisted Model Building with Energy Refinement
You will need to load all module(s) on any one of the lines below before the "amber/24" module is available to load.
cuda/12.4.1 gcc/12.2.0 openmpi/4.1.6
gcc/11.4.0 12.2.0/openmpi/4.1.6
gcc/12.2.0 openmpi/4.1.6
Help:
AMBER (US), Assisted Model Building with Energy Refinement, is a software
package that simulates a family of force fields for the molecular dynamics of
biomolecules. Originally developed by Dr. Peter Kollman's group at UCSF, it
is maintained via an active collaboration among scientists at several
universities including Dr. Adrian Roitberg at UF.
This module sets the following environment variables:
* HPC_AMBER_DIR - installation directory
* HPC_AMBER_BIN - executable directory
* HPC_AMBER_LIB - library directory
* AMBERHOME - main AMBER variable
Reference: https://docs.rc.ufl.edu/software/apps/amber
Version 24
Note that to use amber/24
, all the module on one of the lines need to be loaded in addition to amber/24. For example: module load cuda/12.4.1 gcc/12.2.0 openmpi/4.1.6 amber/24
Search with module keyword
¶
Use module keyword
to search through module description, tags, and keywords.
E.g. this command will find pbsmrtpipe
, smrtsv2
, and also the pacbio
(smrtlink
tools) module, which module spider
will not find.
module keyword smrt
Search with module avail
¶
A much more concise, but context specific table of available modules can be obtained with
module avail
The module avail
command shows all currently accessible branches of
the global tree of modules, which depend on what compiler and MPI
implementation modules are loaded.
The core branch is always shown,
but we also have various version branches for compiler and mpi,
implementation specific, and even python. The top line at each section
shown by module avail
shows exactly what loaded module is responsible
for enabling that branch of the module tree.
Swapping branches¶
To switch between different compiler and MPI implementation of a particular app or to gain access to a module that belongs to a particular branch run the following command to swap the old for the new branch
module swap old new
module swap old/version new/version #this is if you loaded a specific version
If multiple versions of a particular app/version are available module will automatically reload those modules when you swap the branches, so you could seamlessly switch between a single-threaded version of an app you used for testing and an mpi version that will be used for a large-scale computing job.
Managing Module Collections¶
A very useful feature of Lmod is to save and restore custom collections
of modules with module save
and module restore
as described in the
user
collections
section of the User Guide. See the contents of a collection with module
describe
and show a list of your collections with module savelist
.
Module efficiency tip
Loading modules on one line is more efficient than multiple. e.g.
module load cuda/12.4.1 gcc/12.2.0 openmpi/4.1.6 amber/24
is more efficient than
module load cuda/12.4.1
module load gcc/12.2.0
module load openmpi/4.1.6
module load amber/24
Complex workflow tip
Complex workflows that use many modules often run into conflicts. It can be safest to unload
specific modules or purge
all modules and load the next set of modules: e.g.
module load application1
# Run stuff for application 1
module purge # clears all modules
module load application2
# Run stuff for application 2