Using Modules

From CAC Wiki
Jump to: navigation, search

The Frontenac Cluster uses the Lmod Module system to manage the various installed software packages. In basic terms, loading a chosen module will modify various environment variables like $PATH and $LIBRARY_PATH such that the software executables and libraries are more easily found.

There are hundreds of software packages already available using the module system and multiple versions of many of these packages. If you need a package that is not already available or need a newer version, please contact CAC staff. One of the most useful module commands is for searching for installed packages. This is done using the "module spider" command,

e.g. module spider python
Versions:
python/2.7.14
python/2.7.18
python/3.5.4
...
python/3.11.5


This will return the versions of python available on the cluster. Note, some versions may not run given your currently loaded software stack. You can check what other packages and versions you would need to load in order to use a given package by using the "module show" command

e.g. module spider python/3.11.5
You will need to load all module(s) on any one of the lines below before the "python/3.11.5" module is available to load.
StdEnv/2020
StdEnv/2023

Once you find which module you want and if other modules are needed to use it, you can "load" the module(s),

[name@server ~]$ module load StdEnv/2023 python/3.11.5


Other Important module commands

The command module has several subcommands. The normal syntax is [name@server ~]$ module command [other options]

To see a list of available sub-commands use

[name@server ~]$ module help


avail

To list the modules available on a given system, use

[name@server ~]$ module avail

You can obtain a list of modules available for a particular library or tool, for example modules related to openmpi:

[name@server ~]$ module avail openmpi
Note that the module avail command may not list some modules that are incompatible with the modules you have loaded. To see the complete list of all modules use the spider sub-command documented below.


list

The sub-command list lists the modules that are currently loaded in your environment.

[name@server ~]$ module list


load

 [name@server ~]$ module load gcc/9.3
could let you access the GCC compilers, version 9.3.

You can load more than one module with a single command. For example,

[name@server ~]$ module load gcc/9.3 openmpi/4.0
will load at the same time the GCC 9.3 compilers and the Open MPI library 4.0, compiled for GCC.

If you load a module that is incompatible with one you already have loaded, Lmod will tell you that it has replaced the old module with a new one. This can occur especially for compilers and MPI implementations. Sub-command unload


unload

After the load sub-command, unload removes a module from your environment. For example,

[name@server ~]$ module unload gcc/9.3
would remove the GCC 9.3 compilers from your environment.
If you have other modules loaded that depend on this compiler, Lmod will tell you that they have been disabled.


purge

The sub-command purge allows you to remove all the modules you have loaded in one go. Some modules may be marked "sticky" (permanent) by system administrators. These will not be unloaded.


show, help and whatis

The sub-commands show, help and whatis provide additional information about a given module. The show sub-command displays the entire module, help displays a help message, and whatis shows a description of the module.

[nom@serveur ~]$ module help gcc/9.3


apropos or keyword

The sub-commands apropos or keyword allow you to search for a keyword in all modules. If you don't know which module is appropriate for your calculation, you can search the description.


Loading modules automatically

We advise against loading modules automatically in your .bashrc. Instead we recommend that you load modules only when required, for example in your job scripts. To facilitate the repeated loading of a large number of modules we recommend you use a module collection.


Module collections

Lmod allows you to create a collection of modules. To do so, first load the desired modules. For example:

[name@server ~]$ module load gcc/9.3 openmpi/4.0.3 mkl

Then use the save sub-command to save this collection:

[name@server ~]$ module save my_modules
The my_modules argument is a name you give the collection.

You can then in a later session or in a job , restore the collection with the command

[name@server ~]$ module restore my_modules