Difference between revisions of "Environment Modules"

From bwHPC Wiki
Jump to: navigation, search
Line 2: Line 2:
 
manually the user environment.
 
manually the user environment.
   
The bwHPC clusters provide users the possibility to load and unload '''complete enviroments'''
+
The bwHPC clusters (such as '''''bwUniCluster''''') provide users the possibility to load and unload '''complete enviroments'''
 
for compilers, libraries and software packages by single commands. Because of the
 
for compilers, libraries and software packages by single commands. Because of the
 
convenient modularity this software is called ''Environment Modules''.
 
convenient modularity this software is called ''Environment Modules''.
Line 8: Line 8:
 
= Environment Modules =
 
= Environment Modules =
   
The Environment Modules software enables dynamic modification of your environment by the
+
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
 
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
 
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
 
environment variables, such as PATH and MANPATH, to enable access to various installed
  +
software.
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.
 
  +
  +
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.
 
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
 
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
+
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
 
users may have their own collection of modulefiles to supplement or replace the shared
 
modulefiles.
 
modulefiles.
   
A modulefile does not provide configuration of your environment until it is explicitly loaded.
+
A modulefile does not provide configuration of your environment until it is explicitly loaded,
That is, the specific modulefile for a software product or application must be loaded in your environment (with the
+
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:
 
<pre>
 
<pre>
$ module load
+
$ module load compiler/intel
 
</pre>
 
</pre>
command) before the configuration information in the modulefile is effective.
 
   
The modulefiles that are currently loaded for you can be displayed by the
+
All modulefiles that are currently loaded for you can be displayed by the
command
+
command:
 
<pre>
 
<pre>
 
$ module list
 
$ module list
 
</pre>
 
</pre>
. You only have to load further modulefiles, if you want to use additional software
+
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.
 
packages or to change the version of an already loaded software.
   
  +
== Modulefile Help ==
  +
  +
For help on how to use the ''Environment Modules'' software, i.e., the command ''module'',
  +
execute:
  +
<pre>
  +
$ module help
  +
</pre>
  +
or
  +
<pre>
  +
$ man module
  +
</pre>
  +
  +
For help on particular version of modulefiles, e.g. Intel compiler version 12.1, execute:
  +
<pre>
  +
$ module help compiler/intel/12.1
  +
</pre>
  +
  +
== 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:
  +
<pre>
  +
$ module avail
  +
</pre>
  +
The short form the command is:
  +
<pre>
  +
$ module av
  +
</pre>
  +
  +
Available modulefiles can be also displayed in modes:
  +
* each modulefile per one line
  +
<pre>
  +
$ module -t avail
  +
</pre>
  +
* long
  +
<pre>
  +
$ module -l avail
  +
</pre>
  +
  +
== Modulefile categories, versions and defaults ==
  +
  +
The bwHPC clusters (such as '''''bwUniCluster''''') tradionally provide a large variaty 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:
  +
<pre>
  +
category/modulefile_name/version
  +
</pre>
  +
For instances 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 softwares can be addressed by omitting the version number:
  +
<pre>
  +
category/modulefile_name
  +
</pre>
  +
  +
== Loading Modulefiles ==
  +
You can load a modulefile in to your environment to enable easier access to software that
  +
you want to use by executing:
  +
<pre>
  +
$ module load category/modulefile_name/version
  +
</pre>
  +
or
  +
<pre>
  +
$ module add category/modulefile_name/version
  +
</pre>
  +
Loading a modulefile in this manner affects your environment for the current session only.
  +
  +
=== 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:
  +
<source lang="bash">
  +
## if the ’module’ command is defined, $MODULESHOME will be set
  +
if [ -n "$MODULESHOME" ]; then
  +
module load compiler/intel/12.1
  +
fi
  +
</source>
  +
From now on, whenever you log in, the Intel 12.1 compiler modulefile is automatically
  +
loaded in your environment.
  +
  +
=== Modulefile conflicts ===
  +
  +
  +
=== 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 prequired modefile and modulefile versions automatically. However, automatic loading might fail if a different version of that modulefile
  +
is already loaded (cf. modulefile conflicts)
  +
  +
  +
== Unloading Modulefiles ==
  +
  +
== Searching Modulefiles ==
   
 
----
 
----

Revision as of 15:55, 14 December 2013

The usage of compilers, libraries and software packages requires by default users to set up manually the user environment.

The bwHPC clusters (such as bwUniCluster) provide users the possibility to load and unload complete enviroments for compilers, libraries and software packages by single commands. Because of the convenient modularity this software is called Environment Modules.

1 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

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.

1.1 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

1.2 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

1.3 Modulefile categories, versions and defaults

The bwHPC clusters (such as bwUniCluster) tradionally provide a large variaty 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 instances 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 softwares can be addressed by omitting the version number:

category/modulefile_name

1.4 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.

1.4.1 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.

1.4.2 Modulefile conflicts

1.4.3 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 prequired modefile and modulefile versions automatically. However, automatic loading might fail if a different version of that modulefile is already loaded (cf. modulefile conflicts)


1.5 Unloading Modulefiles

1.6 Searching Modulefiles