Using Environment Modules 

Environment Modules


What are environment modules?

The environment modules are a system that allows you to quickly and easily modify your shell environment to access different software packages. The HPC offers a large (and growing) number of software packages to users, and each package may contain several tools, manual pages and libraries, or it may require special setup to work properly. Some software packages come in several versions or flavours, many of which conflict with each other. Modules allows you to tailor your shell to access exactly the packages you need by setting up the relevant environment variables for you, and automatically avoiding many possible conflicts between packages.


Viewing available modules

To view the available modules, enter the following:

module avail

A typical output would look like this:


-------------------------------------/usr/local/cluster-modules------------------------------------------------
R/2.3.1(default)        intel/9.1(default)      matlab/test            pgi/6.1-64-bit          score
R/2.4.0                 matlab/2006b            ns/2.30                pgi/6.2-32-bit          stata/9
dot                     matlab/r15(default)     pgi/6.1-32-bit         pgi/6.2-64-bit(default) use.own

For each available module, the name of the software package is listed first, followed by an optional "/" character and the version or flavour of the package offered. Where multiple versions or flavours of a package exist, the default version is indicated. The default version can be accessed using just the module name, rather than the full name - for example, "pgi" in the above example will refer to module "pgi/6.2-64-bit".

A brief description of each software package can be obtained with the module whatis command:

% module whatis matlab
matlab               : The MATLAB numerical computing environment, Revision 15 (2006a)


Using modules

To setup up your shell environment to access the required package, use the module add command. E.g:

module add pgi

The above command will configure your environment to use the current default version of the Portland Group Compiler Suite tools, which will be the 64-bit flavour of the latest version available.

To view the modules currently added to your environment, use the module list command:

% module list
Currently Loaded Modulefiles:
  1) pgi/6.2-64-bit

To remove modules from your environment, use the module rm command:

% module rm pgi

% module list
No Modulefiles Currently Loaded.


An example package conflict

The 32- and 64-bit flavours of the Portland Group compilers conflict; the compilers have the same names (e.g. pgcc, pgf90), and require different libraries (32- or 64-bit). As a result, modules will prevent you from loading mutliple flavours and versions into your environment:

% module list
No Modulefiles Currently Loaded.

% module add pgi

% module list
Currently Loaded Modulefiles:
  1) pgi/6.2-64-bit

% module add pgi/6.2-32-bit
pgi/6.2-32-bit(15):ERROR:150: Module 'pgi/6.2-32-bit' conflicts with the
currently loaded module(s) 'pgi/6.2-64-bit'
pgi/6.2-32-bit(15):ERROR:102: Tcl command execution failed: conflict pgi

% module list
Currently Loaded Modulefiles:
  1) pgi/6.2-64-bit


Customising your environment

Module instructions do not persist across sessions; if you log out and log back in again, no modules will be loaded in your new login session. If there are a core set of packages which you access regularly, you can place relevant module add commands into your shell startup scripts - either .tcshrc for tcsh or .bash_profile for bash.


Advanced Use

Sometimes you may wish to switch between different versions of a software package. Rather than invoke module rm followed by module add, you can simply use module switch instead:

% module add pgi/6.2-64-bit

% module list
Currently Loaded Modulefiles:
  1) pgi/6.2-64-bit

% module switch pgi/6.2-32-bit

% module list
Currently Loaded Modulefiles:
  1) pgi/6.2-32-bit


Some notes for the curious

If you want to see what environment setup a module is doing behind the scenes, use module show. E.g.:

% module show R/2.3.1
-------------------------------------------------------------------
/usr/local/cluster-modules/R/2.3.1:

module-whatis    the R stats package version 2.3.1 
conflict         R 
prepend-path     PATH /usr/local/packages/R-2.3.1-acml/bin 
-------------------------------------------------------------------


Lancaster HPC home page | ISS home page | University home page

  
To the Top

©Lancaster University   Computer User Agreement   Privacy Statement  

©Lancaster University   ISS Governance   Computer User Agreement   Privacy & Cookies Notice  

Lancaster University
Bailrigg
LancasterLA1 4YW United Kingdom
+44 (0) 1524 65201