Module Software
The Module package provides for the dynamic modification of a users's environment via module files. Module can be used:
- to manage necessary changes to the environment, such as changing the default path or defining environment variables
- to manage multiple versions of applications, tools and libraries
- to manage software where name conflicts with other software would cause problems
Modules have been created for many of the software packages installed on PSC systems. They make your job easier by defining environment variables and adding directories to your path which are necessary when using a given package.
Interactive use
Module is available automatically for interactive use. However, if you are using modules, you should not switch your shell from your login shell during your interactive session.
Batch use
To use module commands in a batch job, add this command to your script:
- On blacklight or salk:
-
source /usr/share/modules/init/shell-name
where shell-name is the shell you are using, e.g., csh, tcsh, bash, sh or ksh. - On warhol
-
source /usr/share/Modules/init/shell-name (note the capital M in Modules in the path) - where shell-name is the shell you are using, e.g., csh, tcsh, bash, sh or ksh.
Dealing with multiple versions of software
Often multiple versions of a given software package are installed. You must load the module for the specific version that you want. To see what versions are available, use the module available command.
module availabile package-name
This example shows that two versions of MOLPRO are installed, 2010.1 and 2012.1
tg-login1:~> module avail molpro -------------------------- /usr/local/opt/modulefiles -------------------------- molpro/molpro2010.1 molpro/molpro2012.1
To see which is the default version, type
module show package-name
Here, for example, you can see that 2012.1 is the default version of MOLPRO.
tg-login1:~> module show molpro ------------------------------------------------------------------- /usr/local/opt/modulefiles/molpro/molpro2012.1: prepend-path PATH /usr/local/packages/molpro/MOLPRO.2012.1/bin -------------------------------------------------------------------
To load the default version, just type
module load package-name
so typing
module load molpro
loads version 2012.1, in this example.
To load a different version, use the specific module name. For example, to load MOLPRO version 2010.1 instead of the default, type
module load molpro2010.1
Module commands
Some useful module commands are:
| module avail | lists all the available modules |
| module help foo | displays help on module foo |
| module display foo | indicates what changes would be made to the environment by loading module foo without actually loading it |
| module load foo | loads module foo |
| module list | displays your currently loaded modules |
| module swap foo1 foo2 | switches loaded module foo1 with module foo2 |
| module unload foo | reverses all changes to the environment made by previously loading module foo |
Conflicts
Modules for different packages or different versions of the same package can sometimes interfere with each other. To ensure that you have the environment that you expect, you should always check which modules are loaded and use the unload command to remove any that you don't need before using load for the ones you want, or use swap to switch modules.
Examples
The module load command loads a specific module. For example, the command
module load icc/10.1.015
sets the proper definitions for you to use version 10.1.015 of the icc compiler. When you are done with a module you can unload it and undo its effect.
module unload icc/10.1.015
Or you can swap it with another module if you want to use a different version of the same software.
module swap icc/10.1.015 icc/10.1.017
After you issue this command, when you run the icc compiler you will be using version 10.1.017 of the compiler, not version 10.1.015.