Modules

Overview

Modules is the system by which most centrally installed software is made available on the iCSF. Modules allow, via a simple interface, the update of various paths (and other environment settings) that allow access to software.

The use of modules also provides a convenient way to switch between different versions of the same software.

As an example, you will most likely be loading a modulefile so that you can use the application software it provides access to. For example, to run MATLAB:

module load apps/binapps/matlab/R2017a

Other versions are also available as documented on the iCSF MATLAB page. The iCSF software pages provide the modulefile names of many of the applications installed on the system – those pages are the best place to look when first using the system.

Commands

The environment is controlled using the module command with various arguments:

  • module list – lists currently loaded modules
  • module avail – lists all available modules
  • module load modulename – loads module “modulename”
  • module unload modulename – unloads module “modulename”
  • module switch oldmodulename newmodulename – switches between two modules
  • module initadd modulename – run this command once to automatically ensure that a module is loaded when you log in. (It creates a .modules file in your home dir which acts as your personal configuration.)
  • module purge – unload all modules
  • module help – brief list of all the available module commands
  • man module – detailed explanation of the above commands and others

Categories

The software available on the iCSF has been placed in categories:

  • apps – for main applications which has subsections for the compiler used to build an application – for example, intel-11.1 – or where no compile was required – binapps.
  • compilers
  • libs – for example, NAG, mkl
  • mpi

The module avail command will list everything available. You can view a single category at a time with:

module avail <category>
  #
  # replacing the optional <category> with one of the above

To use a module/piece of software:

module load <module name>
  #
  # replacing <module name> with the module you want

For example:

module load apps/gcc/R/3.2.0

It is possible, and often necessary, to have multiple modules loaded at once.

Bash Completion

The module paths on iCSF are lengthy, but you can use bash completion to help you. Press TAB part-way through typing a module name and the name will be completed for you or a list of possible completions will be given. Type a few more characters and hit TAB again to narrow the list down until you get the full module name.

Automatically loading modulefiles on log in

We recommend that you only load the modulefiles you require as and when you require them, this way you avoid unexpected software clashes, interactions and environment problems that can cause job failure.

If you do wish to always have certain modulefiles loaded when you log into the iCSF then best practice is to specify them in your .modules environment file, not .bashrc, or .bash_profile. However, bear in mind that the warning above still applies.

Private modules – software you have installed

If you have installed a piece of software in your home directory then you can create your own modulefile for it which saves you having to set variables on the command line, in your .bashrc, .bash_profile or in batch scripts.

  • In your home dir create a directory called ‘privatemodules’ (the name is key)
    mkdir privatemodules
    
  • Within that dir create the required folders and modulefiles (see template below) so you get something like:
    [mxyzabc2@login2 privatemodules]$ pwd
    /mnt/iusers01/zx01/mxyzabc2/privatemodules
    -bash-3.00$ ls -lR
    .:
    total 8
    drwxr-xr-x  2 mxyzabc2 zx01 4096 Mar 26 14:05 app
    
    ./app:
    total 68
    -rw-r--r--  1 mxyzabc2 zx01 533 Mar 26 14:05 2.03
    
  • To use:
    -bash-3.00$ module load use.own; module load app/2.03
    

A template for a modulefile

#%Module1.0####################################################
##
## APP Modulefile
##    -- Replace APP with the name of your app
##
proc getenv {key {defaultvalue {}}} {
  global env; expr {[info exist env($key)]?$env($key):$defaultvalue}
}

## -- The 'module load' line below shoud be where you specify other modulefiles that may be required
## -- Remove the 'module load' line if you do not need it
## -- For example, compliers you used to build the software and mpi
module load compilers/gcc/x.x.x mpi/gcc/openmpi/1.x.x

## -- Now, specify the path to the top level of your software install and set that variable
set     APP_DIR     /PATH/TO/SOFTWARE_ROOT/
setenv  APP_DIR     $APP_DIR

## -- Next add required environment variables as detailed in the software manual
## -- Note, no need for 'export', the below examples add to your existing environment
prepend-path    PATH               $APP_DIR/bin
prepend-path	LD_LIBRARY_PATH    $APP_DIR/lib

Further Information

Last modified on June 18, 2019 at 9:02 am by Site Admin