High-Performance Computing at the NIH

RSS Feed
Environment Modules

Helix and Biowulf now use environment modules to dynamically set up environments for different applications. Users can type commands like:
module load ThisApp
module unload ThisApp

to set up the environment for a particular application. The 'module load' command will set PATH, LD_LIBRARY_PATH and other environment variables as necessary. Any previous environment setups in your .bashrc or .cshrc files will continue to work, but modules are generally easier to use.

The Helix and Biowulf application pages have been updated to describe the modules command for each application. This page contains some general information about modules.


What modules are available?

The command module avail will show all available modules.

[user@helix]$ module avail

---------- /usr/local/Modules/3.2.9/modulefiles -----------
afni/18Oct2012(default) cuda/3.1                modules                 namd/2.9-ipath
afni/18Oct2012-openmp   cuda/4.0.17             mpich2-x86_64           null
afni/21Dec2011          dot                     namd/2.7+plumed1.3      perl/5.12.1
amber/10-gige           fftw3                   namd/2.7-gige           perl/5.12.1-threads
amber/10-ipath          gromacs/4.0.4           namd/2.7-ib             perl/5.8.8
amber/11                gromacs/4.0.7           namd/2.7-ipath          perl/5.8.9
amber/11-gpu            gromacs/4.5.1           namd/2.8+plumed1.3      python/2.5.1
amber/12(default)       gromacs/4.5.3           namd/2.8-gige           python/2.6.4
blast                   gromacs/4.5.5(default)  namd/2.8-gpu            python/2.7.1
chromopainter           gromacs/4.6-dev         namd/2.8-ib             qiime
cmake/2.8.0             hmmer                   namd/2.8-ipath          use.own
cuda/2.3                module-cvs              namd/2.9-gige           velvet/1.2.03
cuda/3.0                module-info             namd/2.9-ib             velvet/1.2.07
[...etc...]

To see the versions available for a particular application, use module avail appname. e.g.

[user@helix]$ module avail gromacs

---------- /usr/local/Modules/3.2.9/modulefiles -----------
gromacs/4.0.4          gromacs/4.5.1          gromacs/4.5.5(default)
gromacs/4.0.7          gromacs/4.5.3          gromacs/4.6-dev

Load a Module

To load a module, use the command module load appname. The default version will get loaded. If you want a particular version, use module load appname/version e.g

[user@helix]$ module list
No Modulefiles Currently Loaded.

[user@helix]$ module load gromacs

[user@helix]$ module list
Currently Loaded Modulefiles:
  1) gromacs/4.5.5
[user@helix]$ module load gromacs/4.5.3

[user@helix]$ module list
Currently Loaded Modulefiles:
  1) gromacs/4.5.3   

Multiple modules can be loaded in a single command. e.g.

[user@helix]$ module load plinkseq macs bowtie

[user@helix]$ module list
Currently Loaded Modulefiles:
  1) plinkseq/0.08    2) macs/2.0.10      3) bowtie/2-2.0.2

Unload a Module

To unload a module, use the command module unload Appname. e.g.

[user@helix]$ module list
Currently Loaded Modulefiles:
  1) gromacs/4.5.3
[user@helix]$ module unload gromacs/4.5.3
See what modules have been loaded
The command module list will show what modules have been loaded.
[user@helix]$ module list
Currently Loaded Modulefiles:
  1) qiime        2) perl/5.8.9

Switch to a different version of an application
The command module switch appname appname/version will switch from one version of an application to another. .
[user@helix]$ module list
Currently Loaded Modulefiles:
  1) perl/5.8.9
[user@helix]$ module switch perl perl/5.12.1
[user@helix]$ module list
Currently Loaded Modulefiles:
  1) perl/5.12.1
Examine a modulefile

If you want to see what changes a module will make to your environment without loading it, use the 'module display' command. e.g.

[user@helix]$ module display blast
-------------------------------------------------------------------
/usr/local/Modules/3.2.9/modulefiles/blast:

module-whatis    Sets up NCBI Blast 
prepend-path     PATH /usr/local/blast/ncbi/bin 
prepend-path     PATH /usr/local/blast/bin 
-------------------------------------------------------------------

If you prefer to set paths directly instead of using modules, you can use the information from 'module display' to do so.

Set up personal modulefiles

Create a directory called privatemodules in your home directory. Then type the command: module load use.own and any personal module files in this directory will become available for you to list, load or unload. You can make copies of the system modulefiles in /usr/local/Modules/default/modulefiles to use as templates.

[user@helix ~]$ module load use.own

[user@helix ~]$ module avail

---------- /home/user/privatemodules ----------
hmmer/2.3

---------- /usr/local/Modules/3.2.9/modulefiles -----------
afni/18Oct2012(default) cuda/3.1                modules                 namd/2.9-ipath
afni/18Oct2012-openmp   cuda/4.0.17             mpich2-x86_64           null
afni/21Dec2011          dot                     namd/2.7+plumed1.3      perl/5.12.1
[...etc...]

As you see above, after loading the 'use.own' module, your private modules are now displayed. If a personal module has the same name as a system module, the personal module will have priority.

Nested modules

You might want to set up a personal modulefile that loads and unloads a collection of other modules. Below is an example of such a module. The module is called 'myngs' and loads a specific version of Novocraft, Cufflinks and Tophat. You will need to put this module file into /home/user/privatemodules/.

#%Module1.0
 
# this module is called myngs
  
module-whatis "Loads  novocraft/3.00.02 cufflinks/2.0.1   tophat/2.0.8/bowtie2-2.1.0"
 
set mode [module-info mode]
#
if { $mode == "whatis" } {  exit }
#
foreach modulename { novocraft/3.00.02 cufflinks/2.0.1   tophat/2.0.8/bowtie2-2.1.0 } {
  if {  [is-loaded $modulename] && $mode == "remove" } { module unload $modulename }
  if { ![is-loaded $modulename] && $mode == "load" }   { module   load $modulename }
#
  if { $mode == "load" || $mode == "remove" } {
    if {  [is-loaded $modulename] } { puts stderr "$modulename is loaded" }
    if { ![is-loaded $modulename] } { puts stderr "$modulename is unloaded" }
  }
}

Here is a sample session using the above module.

[user@helix ~]$ module load use.own

[user@helix ~]$ module list
Currently Loaded Modulefiles:
  1) use.own

[user@helix ~]$ module load myngs
novocraft/3.00.02 is loaded
cufflinks/2.0.1 is loaded
tophat/2.0.8/bowtie2-2.1.0 is loaded

[user@helix ~]$ module list
Currently Loaded Modulefiles:
  1) use.own                      3) cufflinks/2.0.1              5) myngs
  2) novocraft/3.00.02            4) tophat/2.0.8/bowtie2-2.1.0

[user@helix ~]$ module unload myngs
novocraft/3.00.02 is unloaded
cufflinks/2.0.1 is unloaded
tophat/2.0.8/bowtie2-2.1.0 is unloaded

[user@helix ~]$ module list
Currently Loaded Modulefiles:
  1) use.own

Shared Modules

To set up modules that will be shared by a group, the easiest way is to create a 'modulefiles' directory in some area that is shared by the group, and put the group modules into that directory. Each user in the group who wants to access these modules can then create a link from the shared area to their own /home/user/privatemodules/ area. For example, suppose the group has a shared area called /data/DBCImaging.

helix% mkdir /data/DBCImaging/modulefiles
Create the desired modulefiles in this directory. If a personal/group module has the same name as a system module, the system module will get lower priority, and your personal module will be loaded first.

Now each user in the group who wants to use these shared modules should create a link from their /home/user/privatemodules area.

helix% ln -s /data/DCBImaging/modulefiles /home/user/privatemodules/shared
helix% module load use.own
helix% module avail

----------------------- /home/user/privatemodules -------------------------------
blast                       shared/bowtie/0.12.8        shared/bowtie/2-2.0.6
freesurfer/5.1              shared/bowtie/0.12.9        shared/bowtie/2-2.1.0
myngs                       shared/bowtie/2-2.0.0-beta7 shared/octave_test/3.2.4
nested                      shared/bowtie/2-2.0.2       shared/octave_test/3.6.1
shared/bowtie/0.12.5        shared/bowtie/2-2.0.5       susantest

---------------------------- /usr/local/Modules/3.2.9/modulefiles ---------------
BEAST/1.5.2                    eman2/2.06                     openmpi/1.6/gnu/eth
BEAST/1.5.4                    eman2/2.06_121120              openmpi/1.6/gnu/ib
BEAST/1.6.1                    eman2/2.06_ib                  openmpi/1.6/gnu/ipath
BEAST/1.6.2                    express/1.2.2                  openmpi/1.6/intel/eth
BEAST/1.7.1                    express/1.3.1(default)         openmpi/1.6/intel/ib
[...]

helix% module load shared/octave_test/3.2.4

helix% module list
Currently Loaded Modulefiles:
  1) use.own                    2) shared/octave_test/3.6.1

Users who do not have access to the shared area (in this case /data/DBCImaging) will not be able to see the shared modules.

Documentation

Modulefile commands -- what you may need if you write your own modules.