Abisko: Using modules

Using the module command on Abisko

(If you are looking for information about using modules (lmod) on Kebnekaise, go to the page Kebnekaise: Using modules (Lmod).)

The module command is the preferred method for a user to manage the environment. It is used both to load libraries and paths for  specific applications or compilers. The modules are organized into packages which may be added and removed as needed. Please use the module command instead of configuring the environment manually. HPC2N will from time to time make changes to the various packages - these will be transparent to you if you use module to manage your environment.

Below follows a short introduction to the module command. To learn more, read the man page for module.

Typing module or module help at the command line will give you a brief usage report. 

$ module
$ module help

Important module commands

These are some of the more commonly used module commands. To see more commands, run module or module help. All commands should be entered as module <command> OR <command> <module name>. Note that adding modules etc. is only done for that one shell you are working in.

Command What it does
add <module name> OR
load <module name>
Loads the path and other environment variables for the program/library <module name>
rm <module name> OR
unload <module name>
Attempts to undo the changes to the shell environment done by the addition of a module (removes the module)
module display <module name> OR
module show <module name>
Shows what it will do to your environment to add this module
module avail OR
module avail <module name>
Lists the available modules - if a module name is given (like psc for PathScale compilers) it will list the available versions of that module
module purge Removes (or attempts to remove) all modules you had added. Warning: sometimes does not do so correctly!
module list Lists all the modules you currently have loaded

Available modules

In order to learn which modules are available, type

module avail

Available versions of a module

In order to see which versions are available for a certain module (for instance, which PathScale compiler versions are available), you must use the command:

module avail <module name>

Example for PathScale

t-mn01 [~]$ module avail psc

---------------------------- /usr/local/modulefiles ----------------------------
psc/5.0.0(default:5:5.0)   psc/6.0.9
psc/6.0.0                  psc/ekopath-6.0.643(6:6.0)
t-mn01 [~]$ 

This will often tell you which version is the default version (e.g. which version that will be loaded if you only give the program (like psc) and not the version number too (like psc/5.0.0).

Note: module avail does prefix match to whatever string you give it. If you are unsure of the name of a module (say, looking for blas and not knowing it is called xblas), and you do not get any matches from module avail, you might try using module apropos -i instead. It does not always work correctly, but might give matches when the above does not (such as for blas).

module apropos

Used to find matches for programs, where you do not know the name of the module. You must use the -i flag (case insensitive module parameter evaluation) to get the expected output.

Example, blas:

t-mn01 [~]$ module avail blas
t-mn01 [~]$ 
t-mn01 [~]$ module apropos -i blas
openblas/gcc/0.2.13  : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/gcc/0.2.8.a : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/gcc/0.2.9   : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/intel/0.2.13: OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/intel/0.2.8.a: OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/intel/0.2.9 : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/pgi/0.2.13  : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/pgi/0.2.8.a : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/pgi/0.2.9   : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/psc/0.2.13  : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/psc/0.2.8.a : OpenBLAS - High-Performance BLAS based on GotoBLAS2
openblas/psc/0.2.9   : OpenBLAS - High-Performance BLAS based on GotoBLAS2
t-mn01 [~]$ 

Loading/adding a module

To add or load a module, use

module add <module name>

or

module load <module name>

Note that modules can consist of both a name and a version number. When loading a module, you can  use only the name to load the default version, or specify which version you wish to load. 

Examples

(Loading the module openmpi/gcc - the GCC compilers with OpenMPI libraries - default version)

t-mn01 [~]$ module load openmpi/gcc
t-mn01 [~]$ 

 

(loading the module openmpi/gcc/1.8.1 - the GCC compilers with OpenMPI libraries - version 1.8.1)

t-mn01 [~]$ module load openmpi/gcc/1.8.1
t-mn01 [~]$ 

Note that you will need to either load any relevant modules within job submission scripts that use those applications, or load them before submitting the job.

Unloading/removing a module

To unload a module use

module unload <module name>

or

module rm <module name>

List currently loaded modules

You list the currently loaded modules with the command module list (in this case no modules have been loaded yet):

t-mn01 [~]$ module list
Currently Loaded Modulefiles:
  1) snicenvironment   2) systemdefault
t-mn01 [~]$ 

If you load a module this list will change (here openmpi/gcc/1.8.8 was loaded first):

t-mn01 [~]$ module list
Currently Loaded Modulefiles:
  1) snicenvironment     2) systemdefault       3) openmpi/gcc/1.8.8
t-mn01 [~]$ 

Then when you unload the module again:

t-mn01 [~]$ module unload openmpi/gcc/1.8.8 
t-mn01 [~]$ module list
Currently Loaded Modulefiles:
  1) snicenvironment   2) systemdefault
t-mn01 [~]$ 

Show module details

To see what loading a module will do to your path and environment, you can use the command

module show <module name>

Examples

(the effect of loading the default PathScale Compiler suite, 5.0.0)

t-mn01 [~]$ module show psc
-------------------------------------------------------------------
/usr/local/modulefiles/psc/5.0.0:

	PathScale compilers 5.0.0

module-whatis	 PathScale compilers 5.0.0 
setenv		     PSC_VERSION 5.0 
setenv		     PSC /lap/psc/5.0.0 
prepend-path	 PATH /lap/psc/5.0.0/bin
prepend-path	 LD_LIBRARY_PATH /lap/psc/5.0.0/lib/5.0.0/x8664/64
-------------------------------------------------------------------

t-mn01 [~]$ 

(the effect of loading the PathScale Compiler suite, version 6.0.9)

t-mn01 [~]$ module show psc/6.0.9
-------------------------------------------------------------------
/usr/local/modulefiles/psc/6.0.9:

	PSC 6.0.9

module-whatis	 Pathscale compiler 6.0.9 
	PSC 6.0.9

conflict	 psc 
setenv		 PSC_VERSION 6.0 
setenv		 PSC /lap/psc/6.0.9 
prepend-path PATH /lap/psc/6.0.9/bin
-------------------------------------------------------------------

t-mn01 [~]$ 
Updated: 2017-02-24, 23:23