Software module system

From Remeis-Wiki
Jump to navigation Jump to search

Software that comes not packed with the operating system (OS) that is used on the cluster machines is managed by the lmod module system. Per default the system loads a set of commonly used software automatically but this can be changed by you. This page tries to help you accessing special software which is not part of the default environment.

There is a number of reasons why software is not part of the default setup but the most common one is interference with other software. This software is installed by the admins on request. That means if software has to be installed for you write a message to the admin list!

Using lmod

When you log in on any machine you have access to all the OS software and a set of default packages (from now on we call them modules). To interact with the modules via lmod a shell function module is defined. In case this function is not defined already check if you have a line

source /software/cshrc.in

in your .cshrc.

(Or, in case you are using bash source /software/profile.in should be in your .bashrc.)

By simply typing

$ module

one is provided with a list of arguments the module command understands and a description of their usage.

List loaded modules

One of the first things one wants to check is what modules are currently loaded. This is as simple as typing

$ module list

which should print a table of different modules amongst which the default environment remeis is listed.

List available modules

In a similar manner you can easily list the modules that are currently defined for your login by typing

$ module avail

This reports all modules and their versions sorted by the categories they belong to. A yellow L after module indicates that this module is currently loaded, a D indicates this version as default (see below). (Additional indicators mark a module as hidden (H) or sticky (S).)

To list if a certain module is available you can use

$ module avail heasoft

or

$ module avail heasoft/6.28

to list an exact version (here 6.28).

Loading and unloading modules

A module is a set of instructions to modify your current environment. In most cases this is simply a change of variables such as PATH. To execute the environment change associated with a module a simple call to

$ module load heasoft

is sufficient. In this example the instructions for the module heasoft get executed and provide you with all the programs that are part of the HEASARC software library (such as XSPEC ...).

Without specifying a version number after the module name (such as heasoft/6.28) lmod will load the default version. Usually this corresponds to the highest version number but it must not be (for example when the software was just upgraded and is not tested yet). In case you require a different version you can load it by specifying the requested version number like

$ module load heasoft/6.28

This will load heasoft version 6.28. If the requested module or version is not available lmod will tell you so.

The opposite of loading a module is unloading it which will essentially revert all the environment changes such that your environment is the same as before you use module load.

$ module unload heasoft

will always unload the currently loaded version of heasoft no matter the default.

Dependencies

Most of the time when you load a module it requires other modules to be loaded first. For the majority of the modules this simply happens silently in the background. If, for example, you load satscripts (extraction scripts for the satellites) which depends on caldb you also load the caldb module. On the other hand there are modules which only are of use once a prerequisite is met. These modules are extensions (marked with an E) to others. So is isis an extension of heasoft and you have to load the heasoft module prior to be able to load isis.

Clean the environment

Sometimes it might be necessary for you to remove all loaded modules. This can be efficiently done by

$ module purge

You will be informed that a module .system is not unloaded because it is sticky. This module sets environment variables which are necessary for the system to work properly. This can be safely ignored. (If you really need to remove it as well use the --force option.)

If you want the default environment back a call to

$ module restore

will execute all necessary changes.

Changing the default modules and sets

Depending on your normal workflow you may frequently need to access modules which are not part of the globally defined default (remeis). If this is the case you might want to define your own default. For this there are essentially two ways possible.

Set LMOD_SYSTEM_DEFAULT_MODULES

This is the quickest way if you want a small number of modules in your default. You can add this variable to your login script and set it to a colon separated list of modules you want to load, like

setenv LMOD_SYSTEM_DEFAULT_MODULES "heasoft:isis"

This example will set heasoft and isis as the default and nothing else.

If, instead, you want to have the default remeis set plus additional modules as default, you have to explicitly make remeis part of the default set

setenv LMOD_SYSTEM_DEFAULT_MODULES "remeis:Localmodels/warmabs"

Here we add the warmabs local model which requires heasoft, so better keep the global default.

Defining a default set

For a default with more modules it is quicker to set your current environment with the module load command and then user

$ module save

This will store the environment as it currently is as your personal default and it will get loaded on every login. A defined default set always takes precedence over the LMOD_SYSTEM_DEFAULT_MODULES variable. To view all defined sets use

module savelist

Naming sets

If you require to switch between different environments it is possible to save the current environment under a given name

$ module save my_working_set

Here we saved the current environment under the name my_working_set. Unlike the default it will not get loaded on every log in. Instead we have to load it explicitly by name

$ module restore my_working_set

A set can be deleted with

$ module disable my_working_set

If the name is not given, the default set is disabled.

Further information

If you want to get more information about the module system you can start by reading the help of module help.

More information on how lmod works and also how you can define your own modules for software you compiled can be found on the lmod documentation web page.