Environment Modules: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
{| style="border-style: solid; border-width: 1px" |
{| style="border-style: solid; border-width: 1px" |
||
! Navigation: [[ |
! Navigation: [[BwHPC_Best_Practices_Repository|bwHPC BPR]] / [[BwUniCluster_User_Guide|bwUniCluster]] |
||
|} |
|} |
||
Revision as of 20:00, 17 January 2014
Navigation: bwHPC BPR / bwUniCluster |
---|
Important note: bwUniCluster is not in production mode yet.
The usage of compilers, libraries and software packages requires by default users to set up manually their session environment.
The bwHPC clusters (such as bwUniCluster) provide users the possibility to load and unload complete environments for compilers, libraries and software packages by single commands. Because of the convenient modularity this software is called Environment Modules.
Environment Modules
The Environment Modules software enables dynamic modification of your environment by the use of so-called modulefiles. A modulefile contains information to configure the shell for an application. Typically, a modulefile contains instructions that alter or set shell environment variables, such as PATH and MANPATH, to enable access to various installed software.
One of the key features of using the Environment Modules software is to allow multiple versions of the same software to be used in your environment in a controlled manner. For example, two different versions of the Intel C compiler can be installed on the system at the same time - the version used is based upon which Intel C compiler modulefile is loaded.
The software stack of bwHPC clusters provides a number of modulefiles. You can also create your own modulefiles. Modulefiles may be shared by many users on a system, and users may have their own collection of modulefiles to supplement or replace the shared modulefiles.
A modulefile does not provide configuration of your environment until it is explicitly loaded, i.e., the specific modulefile for a software product or application must be loaded in your environment before the configuration information in the modulefile is effective. For instance loading the default Intel C and Fortran compiler you must execute:
$ module load compiler/intel
Modulefile Help
For help on how to use the Environment Modules software, i.e., the command module, execute:
$ module help
or
$ man module
For help on particular version of modulefiles, e.g. Intel compiler version 12.1, execute:
$ module help compiler/intel/12.1
Display all available modulefiles
Available modulefiles are modulefiles that can be load by the user. A modulefile must be loaded before it provides changes to your environment, as described in the introduction to this section. You can display all available modulefiles on the system by executing:
$ module avail
The short form the command is:
$ module av
Available modulefiles can be also displayed in modes:
- each modulefile per one line
$ module -t avail
- long
$ module -l avail
Modulefile categories, versions and defaults
The bwHPC clusters (such as bwUniCluster) traditionally provide a large variety of software and software versions. Therefore modulefiles are divided in category folders containing subfolders of modulefiles containing modulefile versions, and must be addressed as follows:
category/modulefile_name/version
For instance the Intel compiler 12.1 belongs to the category of compilers, therefore the modulefile 12.1 is placed under the category compiler and intel.
In case of multiple software versions, one version will be always defined as the default version. Modulefiles of such default software can be addressed by omitting the version number:
category/modulefile_name
Loading Modulefiles
You can load a modulefile in to your environment to enable easier access to software that you want to use by executing:
$ module load category/modulefile_name/version
or
$ module add category/modulefile_name/version
Loading a modulefile in this manner affects your environment for the current session only.
Modulefile conflicts
By default you can not load different versions of same software modulefile in same session. Loading for example Intel compiler version 13.1 while Intel compiler version 12.1 is loaded results in error message as follows:
ERROR:150: Module 'compiler/intel/13.1' conflicts with the currently loaded module(s) 'compiler/intel/12.1'
|
The solution is unloading or switching modulefiles.
Automatic Loading
If you frequently use one or more modulefiles that are not loaded when you log in to the system, you can set up your environment to automatically load those modulefiles for you. A method for doing this is to modify your shell startup script to include instructions to load the modulefile automatically.
For example, if you want to automatically load the Intel 12.1 modulefile when you log in, edit your shell startup script to include the following instructions. This example assumes that you use bash as your login shell. Edit the $HOME/.bashrc file as follows:
## if the ’module’ command is defined, $MODULESHOME will be set
if [ -n "$MODULESHOME" ]; then
module load compiler/intel/12.1
fi
|
From now on, whenever you log in, the Intel 12.1 compiler modulefile is automatically loaded in your environment.
Modulefiles depending on Modulefiles
Some software depends on libraries to be loaded to the user environment. Therefore the corresponding modulefile of the software must be loaded together with the modulefiles of the libraries.
By default such software modulefiles try to load required modulefile and modulefile versions automatically. However, automatic loading might fail if a different version of that required modulefile is already loaded (cf. modulefile conflicts).
Unloading Modulefiles
To unload or to remove a modulefile execute:
$ module unload category/modulefile_name/version
or
$ module remove category/modulefile_name/version
Unloading a modulefile that is loaded by default makes it inactive for the current session only - it will be reloaded the next time you log in.
Display your loaded Modulefiles
All modulefiles that are currently loaded for you can be displayed by the command:
$ module list
You only have to load further modulefiles, if you want to use additional software packages or to change the version of an already loaded software.