Search Docs by Keyword

Table of Contents

Lmod modules — introduction and instructions

TIP: See this page for a list of modules and how to search modules: All modules – Module Search

About Modules

On the cluster, we want a variety of apps available, including different versions of the same app and apps that are incompatible. Part of how we accomplish this is by using environment modules. When you first login to the cluster, you’re presented with a very basic software environment. One of the ways apps are made available to you or your jobs by loading the modules for them. The modules update shell environment variables so that the system can find and use the apps of your choice. Modules replace the need for separate setup scripts.

Our implementation of environment modules uses Lmod and the bash shell. That page has some excellent documentation for those wishing to learn more about Lmod. In addition to some new features, we’ve adopted a more systematic naming and versioning convention, and we’re more actively curating our app inventory. Below is a condensed version with more FASRC-specific information.

What Software Qualifies for Modules

There is a wide variety of software that users use along with a variety of needs in terms of versioning and build style. To support all of that is intractable. Software modules are those packages that are considered core to cluster operations, which include:

  • Compilers
  • MPI
  • Python
  • R
  • Commonly Used Math Libraries (e.g. FFTW, GSL, MKL)
  • Commonly Used IO Libraries (e.g. HDF5, NetCDF)
  • Licensed Software

These libraries we provide via modules. Decisions on if a software qualifies to be a module is made at the sole discretion of the FASRC staff. For other libraries that are not in our modules we invite users to look at our Software documentation for other options for installation.  Particularly tools like Spack can build a host of different libraries with a variety of options. Singularity is also an option for very complicated software stacks or those with Dockerfiles.

How to Use Modules

You can load one or more modules using the module load [module(s) name] command. Examples:
module load matlab/R2017a-fasrc02
module load gcc/7.1.0-fasrc01 openmpi/2.1.0-fasrc02 netcdf/4.5.0-fasrc01 
To see what modules you have loaded, run:
module list
To unload a module, run:
module unload [module name]
To unload all modules currently loaded, run:
module purge
To save all currently-loaded modules as a collection, run:
module save <collection-name>
To restore a previously-saved collection of modules, run:
module restore <collection-name>

Finding Modules

For the most robust listing of modules, please use:

  • module avail: Lists the modules available at your current level of the hierarchy based on compiler and MPI.
  • The module spider [name or partial name] command (example: module spider matlab)

Loading a Module May Reveal More Modules

For example, loading intel/17.0.4-fasrc01 will make available all the apps compiled with that version of the intel compiler suite. This is done for each compiler choice and for each MPI implementation choice.
For example, checking the available version of the library netcdf   using the module avail command returns one version.

[user@rclogin ~]$ module avail netcdf
------- /n/helmod/modulefiles/centos7/Core -------
netcdf/4.3.2-fasrc03

After loading the compiler module ( in this case intel/17.0.4-fasrc01, applications built with the intel compiler are made available and become the default. We can see in this case more versions of netcdf

[user@rclogin ~]$ module load intel/17.0.4-fasrc01
[user@rclogin ~]$ module avail netcdf
--------- /n/helmod/modulefiles/centos7/Comp/intel/17.0.4-fasrc01 ----------
netcdf/4.3.2-fasrc04    netcdf/4.5.0-fasrc02 (D)
--------- /n/helmod/modulefiles/centos7/Core -----------
netcdf/4.3.2-fasrc03

Bear in mind that the module avail command does not show all  the different modules you could possibly use, but only the ones that you could load in the current environment, given the modules already loaded. You should use module-query or the portal to find specific modules. module avail is used here to demonstrate how you can see the change in available modules when loading modules that unlock a dependency and make other modules available.

Module Naming and Versioning

You can load specific versions by supplying the full module name (example: module load matlab/R2017a-fasrc02) or let the module system automatically load the latest version (example: module load matlab). The default is determined either according to alphanumeric sorting or in some cases the version we have chosen to be the default latest version based on stability or commonality.

It is strongly recommended to load modules specifying name and specific version.  This way you are protected in case the default version changes.

Version Changes When Loading Dependencies.

If module A requires module B, and you already have some version of B loaded, A will usually consider the dependency satisfied, rather than force a specific different (often older) version of B to be loaded. This has the potential to cause issues if a specific version is required. Be sure to look at the module’s requirements before assuming this will work. Or, at the very least, test your script before trusting that it will work.

© The President and Fellows of Harvard College
Except where otherwise noted, this content is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International license.