Center for Piezoelectrics by Design web page

Module help and local modulefiles

Modules greatly simplify the process of setting up your computing environment. Modules take care of managing different versions of software packages, compilers, and libraries for you.

Useful module commands
command description
module avail list the avaliable modules
module list list the currently loaded modules
module load X load module X
module unload X unload module X
module clear unload all modules
module switch X Y unload X and load Y
module initadd X append your startup files to automatically load this module
module initrm X remove this module from your startup files

 

 

Module examples

New users will have the Intel v10.1 compilers and OpenMPI-v1.2.5 loaded by default. We can see this when we log in:

<3 /~>module list
Currently Loaded Modulefiles:
  1) intel/10.1   2) openmpi-1.2.5
<4 /~>

Now say we want to get rid of the openmpi-1.2.5 environment:

<14 /~>module list
Currently Loaded Modulefiles:
  1) intel/10.1   2) openmpi-1.2.5
<15 /~>module unload openmpi-1.2.5
<16 /~>module list
Currently Loaded Modulefiles:
  1) intel/10.1

We can then load a new MPI environment:

<17 /~>module load mvapich2-1.0.2 
module list
Currently Loaded Modulefiles:
  1) intel/10.1   2) mvapich2-1.0.2

Default loaded modules

New users (added after April 20, 2008) will have the intel/10.1 compilers, the openmpi-1.2.5 mpi environment and the default scientific packages (abinit-5.4.4 , quantum-espresso CVS022708, and DACAPO SVN033108). The choice of compilers is up to the user, but the default should suffice. The openmpi-1.2.5 environment has been shown to be a bit more robust than the mvapich versions, therefore this is chosen as the default.

If you want to add or delete modules that are loaded by default, simply use the module initrm and module initadd commands. BEWARE, if you initrm all loaded modules, you will not be able to initadd any more. This seems to be a bug.

Alternatively, you can edit your .cshrc and .bashrc files:

<2 pzt ->~>cat .cshrc
#!/bin/csh
# The commands in this file are executed each time a new csh shell
# is started.
#
.
.
.
.

module load intel/10.1 openmpi-1.2.5 espresso/espresso-CVS

The last line of these files can be set to load any valid combination of modules. Every shell you invoke will have these modules loaded automatically.

Avaliable modules

The simplest way to see what modules are available is by using the module avail command

<3 pzt ->~>module avail

------------------------------------------------------------- /share/apps/modulefiles/compilers --------------------------------------------------------------
absoft      intel/10.1  intel/9.1   pathscale   pgi/7.1     pgi/7.1-3   pgi32/7.1   pgi32/7.1-3 pgi64/7.1   pgi64/7.1-3

---------------------------------------------------------- /share/apps/modulefiles/mpi_environment -----------------------------------------------------------
mvapich-1.0-intel      mvapich2-1.0.1         mvapich2-1.0.2         openmpi-1.2.5
mvapich-1.0-pgi        mvapich2-1.0.1_noslurm openmpi-1.2.4

------------------------------------------------------------- /share/apps/modulefiles/scientific -------------------------------------------------------------
DEF/abinit                       abinit/abinit-544_mvapich2       espresso/espresso-323_mvapich2
DEF/dacapo                       abinit/abinit-544_openmpi125     espresso/espresso-CVS
DEF/espresso                     dacapo/dacapo_SVN033108          espresso/espresso-CVS_openmpi125

---------------------------------------------------------------- /share/apps/modulefiles/misc ---------------------------------------------------------------
dot

However, this just lists the names of the modules. To get more information, module whatis is helpful:

absoft               : Set up environment for Absoft Fortran
intel/10.1           : Set up environment for the Intel C/C++ compiler suite v10.1
intel/9.1            : Set up environment for the Intel C/C++ compiler suite v9.1
pathscale            : Set up environment for pathscale v3.0 compilers
pgi/7.1              : Changes the PGI home directory to linux86-64 7.1
pgi/7.1-3            : Changes the PGI home directory to linux86-64 7.1-3
pgi32/7.1            : Changes the PGI home directory to linux86 7.1
pgi32/7.1-3          : Changes the PGI home directory to linux86 7.1-3
pgi64/7.1            : Changes the PGI home directory to linux86-64 7.1
pgi64/7.1-3          : Changes the PGI home directory to linux86-64 7.1-3
mvapich-1.0-intel    : Set up environment for mvapich v1.0 using the intel compilers
mvapich-1.0-pgi      : Set up environment for mvapich v1.0 using the pgi compilers
mvapich2-1.0.1       : Set up environment for mvapich2 v1.0.1
mvapich2-1.0.1_noslurm: Set up environment for mvapich2 v1.0.1 (without SLURM PMI)
mvapich2-1.0.2       : Set up environment for mvapich2 v1.0.2
openmpi-1.2.4        : Set up environment for OpenMPI-1.2.4
openmpi-1.2.5        : Set up environment for OpenMPI-1.2.5
abinit/abinit-544_mvapich2: Set up PATH for Abinit 5.4.4 using mvapich2
abinit/abinit-544_openmpi125: Set up PATH for Abinit 5.4.4 using openmpi-1.2.5
dacapo/dacapo_SVN033108: Set up PATH for Dacapo SVN033108 using openmpi-1.2.5
DEF/abinit       : Set up PATH for Abinit 5.4.4 using openmpi-1.2.5
DEF/dacapo       : Set up PATH for Dacapo SVN033108 using openmpi-1.2.5
DEF/espresso     : Set up PATH for Quantum Espresso vCVS_022708 using openmpi-1.2.5
espresso/espresso-323_mvapich2: Set up PATH for Quantum Espresso v3.2.3
espresso/espresso-CVS: Set up PATH for Quantum Espresso vCVS_022708 using openmpi-1.2.5
espresso/espresso-CVS_openmpi125: Set up PATH for Quantum Espresso vCVS_022708 using openmpi-1.2.5
dot                  : adds `.' to your PATH environment variable

The first column is the module name and the second column is a short description. Due to backward compatibility and ease of use, there are multiple module names for the same module. For instance, the DEF/abinit, DEF/espresso, and DEF/dacapo modules are duplicates of other modules that can be used to load the most up to date versions of these packages.

Module conflicts

Now lets reload openmpi-1.2.5:

<22 /~>module list
Currently Loaded Modulefiles:
  1) intel/10.1  2) mvapich2-1.0.2
<23 /~> module load openmpi-1.2.5
openmpi-1.2.5(24):ERROR:150: Module 'openmpi-1.2.5' conflicts with the currently loaded module(s) 'mvapich2-1.0.2'
openmpi-1.2.5(24):ERROR:102: Tcl command execution failed: conflict openmpi openmpi-1.2.4 openmpi-1.2.5 mvapich2 mvapich2-1.0.1 mvapich2-1.0.2 mvapich2-1.0.1_noslurm mvapich

This is a module conflict, we need to first unload the openmpi-1.2.5 module. We can just use the switch command:

<24 /~>module switch mvapich2-1.0.2 openmpi-1.2.5
<25 /~>module list
Currently Loaded Modulefiles:
  1) intel/10.1   2) openmpi-1.2.5

Module prerequisites

What about changing to a different compiler? Lets load the pathscale compiler:

<31 /~>module load pathscale
pathscale(19):ERROR:150: Module 'pathscale' conflicts with the currently loaded module(s) 'intel/10.1'
pathscale(19):ERROR:102: Tcl command execution failed: conflict pathscale intel/9.1 intel/10.1 pgi/7.1 pgi/7.1-3 pgi32/7.1 pgi32/7.1-3 pgi64/7.1 pgi64/7.1-3 absoft

Can't load two compilers simultaneously

<32 /~>module switch intel/10.1 pathscale
<33 /~>module list
Currently Loaded Modulefiles:
  1) pathscale   2) openmpi-1.2.5
<34 /~>

But there is a problem. The openmpi-1.2.5 module needs to have a compiler loaded before it can be loaded, you can see this via:

<35 /~>module show openmpi-1.2.5
-------------------------------------------------------------------
/share/apps/modulefiles/mpi_environment/openmpi-1.2.5:

module-whatis    Set up environment for OpenMPI v1.2.5
conflict         openmpi openmpi-1.2.4 openmpi-1.2.5 mvapich2 mvapich2-1.0.1 mvapich2-1.0.2 mvapich2-1.0.1_noslurm mvapich
prereq   absoft intel/9.1 intel/10.1 pgi/7.1 pgi/7.1-3 pgi32/7.1 pgi32/7.1-3 pgi64/7.1 pgi64/7.1-3 pathscale
setenv           OMPI_CC icc
setenv           OMPI_F90 ifort
setenv           OMPI_F77 ifort
setenv           OMPI_CXX icpc
setenv           OMPI_FC ifort
prepend-path     PATH /share/apps/openmpi125/bin
prepend-path     LD_LIBRARY_PATH /share/apps/openmpi125/lib
prepend-path     MANPATH /share/apps/openmpi125/man
setenv           MPIHOME /share/apps/openmpi125
-------------------------------------------------------------------

We can see the problem here:

<39 /~>env|grep MPI
COMPILER=pathscale
MPIHOME=/share/apps/openmpi125
OMPI_F77=ifort
OMPI_FC=ifort
OMPI_CC=icc
OMPI_CXX=icpc
OMPI_F90=ifort

Even though the environment is set for pathscale, the openmpi-1.2.5 wrappers are still set to use intel/10.1. This can be easily fixed by:

<40 /~>module update
<41 /~>env | grep MPICH
COMPILER=pathscale
MPIHOME=/share/apps/openmpi125
OMPI_F77=pathf77
OMPI_FC=pathf90
OMPI_CC=pathcc
OMPI_CXX=pathCC
OMPI_F90=pathf90


©2009 The College of William and Mary