You are here: Home Resources Software User Environment Modules

Modules

At PDC we use modules on our clusters to get to the software that you need.

At PDC there is a variety of machines, operating systems, projects, different versions of the same code that all have their special set of programs to run. To be able to maintain and use this large set of programs we supply you with the concept of modules (Tcl modules), invoked by the module command. With the command:

module add someProgramName

you add proper paths to someProgramName-related directories to your PATH-variable.

You can list all available programs on a machine using the command:

module avail

To get information on the particular program that you want to use, please look at the output from:

module show someProgramName

It is really important to look at the above output since it will tell you about how to run the program and about any needed special tricks!

The command:

module list

tells you which modules you have currently loaded.

It is also possible to swap one module for another:

module show fromSomeProgramName toSomeProgramName

Modules and shells

In order to use modules there has to be module definitions available for your shell. Module definitions for the shells bash, csh,  ksh, sh,  tcsh and zsh are available at PDC. If users want to change the default shell of their account they need to contact PDC. A common mistake is to create a script for another shell than the default one, and then discover that the module commands (module add for instance) are not always inherited between shells.

Example

Having a bash shell (the default at PDC) a simple bash script that adds the MPI module may look like this:

#!/bin/bash
module add mpi

However, if you instead had a tcsh shell as your default shell, the above script would fail and generate an error message:

./mymoduletest.sh: line 2: module: command not found

The best workaround for the tsch user would be to rewrite the bash script as a tcsh script instead. An alternative is to explicitly load (reset) module definitions in the beginning of the bash script (before invoking) the module command:

#!/bin/bash
. /pdc/modules/etc/init/bash
module add mpi

Please note the space between the dot and the path above!

If using this method, please be aware that it is not a portable modification of the script and that you have to be careful (for instance if using chains of scripts) since invoking the above module initialization several timer might reset the inherited memory of previously loaded modules.