Using modules on maya

Introduction

We use modules on maya to help users manage their Linux environments. Different environment settings are needed in the course of using the various applications available on the cluster. Modules provide a simple way to prepare your environment for your application.

As an example, see the pages for How to Compile C and How to run R . Users load a module during their session that determines what happens when using the “mpicc” command.

How to use modules

Complete documentation of module commands and options can be found by

[araim1@maya-usr1 ~]$ man module

but we will illustrate some useful commands here. To see all the modules we currently have loaded:

[araim1@maya-usr1 ~$ module list
Currently Loaded Modulefiles:
  1) gcc/4.8.1                     3) intel/2013_sp1
  2) slurm/2.5.7                   4) mvapich2/intel/2013_sp1/1.9
[araim1@maya-usr1 ~]$

We can see the “show” command to see what a module does

[araim1@maya-usr1 ~]$ module show matlab/r2013b 
-------------------------------------------------------------------
/cm/shared/modulefiles/matlab/r2013b:

prepend-path	 PATH /usr/cluster/matlab/r2013b/bin 
prepend-path	 MLM_LICENSE_FILE 1701@license5.umbc.edu,1701@license6.umbc.edu,1701@license7.umbc.edu 
setenv		 MLROOT /usr/cluster/matlab/r2013b 
-------------------------------------------------------------------

[araim1@maya-usr1 ~]$

We can list all available modules which have been defined by the system administrators. (Note: your listing may differ, depending on the current configuration).

[araim1@maya-usr1 ~]$ module avail 

------------------------------ /cm/local/modulefiles -------------------------------
cluster-tools/6.1 freeipmi/1.2.6    module-info       shared
cmd               ipmitool/1.8.12   null              use.own
dot               module-git        openldap          version

------------------------------ /cm/shared/modulefiles ------------------------------
acml/gcc/64/5.3.1                       hwloc/1.7
acml/gcc/fma4/5.3.1                     intel-cluster-checker/2.1.1
acml/gcc/mp/64/5.3.1                    intel-cluster-runtime/ia32/3.6
acml/gcc/mp/fma4/5.3.1                  intel-cluster-runtime/intel64/3.6
acml/gcc-int64/64/5.3.1                 intel-cluster-runtime/mic/3.6
acml/gcc-int64/fma4/5.3.1               intel-tbb-oss/ia32/42_20131003oss
acml/gcc-int64/mp/64/5.3.1              intel-tbb-oss/intel64/42_20131003oss
acml/gcc-int64/mp/fma4/5.3.1            iozone/3_414
acml/open64/64/5.3.1                    iperf/2.0.5
acml/open64/fma4/5.3.1                  lapack/gcc/64/3.4.2
acml/open64/mp/64/5.3.1                 lapack/open64/64/3.4.2
acml/open64/mp/fma4/5.3.1               matlab/r2013b
acml/open64-int64/64/5.3.1              mpich/ge/gcc/64/3.0.4
acml/open64-int64/fma4/5.3.1            mpich/ge/open64/64/3.0.4
acml/open64-int64/mp/64/5.3.1           mpiexec/0.84_432
acml/open64-int64/mp/fma4/5.3.1         mvapich/gcc/64/1.2rc1
blacs/openmpi/gcc/64/1.1patch03         mvapich/open64/64/1.2rc1
blacs/openmpi/open64/64/1.1patch03      mvapich2/gcc/64/1.9
blas/gcc/64/1                           mvapich2/intel/composer_xe_2013_sp1/1.9
blas/open64/64/1                        mvapich2/open64/64/1.9
bonnie++/1.97.1                         mvapich2/pgi/13.10/1.9
cmgui/6.1                               mvapich2/pgi/14.1/1.9
comsol/4.3b                             netcdf/gcc/64/4.3.0
comsol/4.4                              netcdf/open64/64/4.3.0
cuda55/blas/5.5.22                      netperf/2.6.0
cuda55/fft/5.5.22                       open64/4.5.2.1
cuda55/profiler/5.5.22                  openblas/bulldozer/0.2.6
cuda55/tdk/5.319.43                     openblas/dynamic/0.2.6
cuda55/toolkit/5.5.22                   openblas/istanbul/0.2.6
default-environment                     openblas/nehalem/0.2.6
fftw2/openmpi/gcc/64/double/2.1.5       openblas/sandybridge/0.2.6
fftw2/openmpi/gcc/64/float/2.1.5        openmpi/gcc/64/1.6.5
fftw2/openmpi/open64/64/double/2.1.5    openmpi/open64/64/1.6.5
fftw2/openmpi/open64/64/float/2.1.5     openmpi/pgi/13.10/1.6.5
fftw3/openmpi/gcc/64/3.3.3              pbspro/12.1.1.131502
fftw3/openmpi/open64/64/3.3.3           pgi/13.10
gcc/4.8.1                               pgi/14.1
globalarrays/openmpi/gcc/64/5.1.1       R/3.0.2
globalarrays/openmpi/open64/64/5.1.1    scalapack/gcc/64/1.8.0
gromacs/4.6.5                           scalapack/open64/64/1.8.0
hdf5/1.6.10                             sge/2011.11p1
hdf5_18/1.8.11                          slurm/2.5.7
hpl/2.1                                 torque/4.2.2

----------------------------- /usr/cluster/modulefiles -----------------------------
intel/2013_sp1               mvapich2/pgi/14.2/1.9
matlab/r2013b                openmpi/intel/2013_sp1/1.6.5
mvapich2/gcc/4.8.1/1.9       openmpi/intel/2013_sp1/1.7.4
mvapich2/intel/2013_sp1/1.9  pgi/14.2
[araim1@maya-usr1 ~]$

If we try to use the PGI compiler with the current setup (given above by “module list”), it won’t be available.

[araim1@maya-usr1 ~]$ pgcc
-bash: pgcc: command not foun
[araim1@maya-usr1 ~]$

To make the compiler available, we will load “pgi/14.1”.

[araim1@maya-usr1 ~]$ module load pgi/14.1
[araim1@maya-usr1 ~]$ pgcc --version

pgcc 14.1-0 64-bit target on x86-64 Linux -tp nehalem,sandybridge 
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
[araim1@maya-usr1 ~]$

If we also try to load “pgi/14.2”, it will cause a conflict in our environment, so the module system prevents us from doing it.

[araim1@maya-usr1 ~]$ module load pgi/14.2
pgi/14.2(6):ERROR:150: Module 'pgi/14.2' conflicts with the currently loaded module(s) 'pgi/14.1'
pgi/14.2(6):ERROR:102: Tcl command execution failed: conflict    pgi
[araim1@maya-usr1 ~]$

In order to load “pgi/14.2”, we must first unload “pgi/14.1”

[araim1@maya-usr1 ~]$ module unload pgi/14.1 
[araim1@maya-usr1 ~]$ module load pgi/14.2
[araim1@maya-usr1 ~]$ pgcc --version

pgcc 14.2-0 64-bit target on Linux -tp nehalem,sandybridge 
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
[araim1@maya-usr1 ~]$

We can go back to the original state if we unload “pgi/14.1”

[araim1@maya-usr1 ~]$ module unload pgi/14.2 
[araim1@maya-usr1 ~]$ module list
Currently Loaded Modulefiles:
  1) gcc/4.8.1                     3) intel/2013_sp1
  2) slurm/2.5.7                   4) mvapich2/intel/2013_sp1/1.9
[araim1@maya-usr1 ~]$ pgcc --version
-bash: pgcc: command not found
[araim1@maya-usr1 ~]$

Note that we could have PGI, GCC, and the Intel Compiler loaded simultaneously without any conflict.

Another useful module command is “swap” which will replace one loaded module with another. (As opposed to being loaded on top, as in the example above). As an example, let’s try loading “pgi/14.2”, and then swapping it out for an older version “pgi/14.1”.

[araim1@maya-usr1 ~]$ module load pgi/14.2
[araim1@maya-usr1 ~]$ pgcc --version

pgcc 14.2-0 64-bit target on Linux -tp nehalem,sandybridge 
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
[araim1@maya-usr1 ~]$ module swap pgi/14.1
[araim1@maya-usr1 ~]$ pgcc --version

pgcc 14.1-0 64-bit target on x86-64 Linux -tp nehalem,sandybridge 
The Portland Group - PGI Compilers and Tools
Copyright (c) 2014, NVIDIA CORPORATION.  All rights reserved.
[araim1@maya-usr1 ~]$

How to automatically load modules at login

The “initadd” command can be used to make a module be loaded on every login. This is useful for applications you use on a regular basis.

[araim1@maya-usr1 ~]$ module initadd pgi/14.2
[araim1@maya-usr1 ~]$ logout
Connection to maya.rs.umbc.edu closed.
[araim1@localhost ~]$ ssh -X araim1@maya.rs.umbc.edu
...
[araim1@maya-usr1 ~]$ module list 
Currently Loaded Modulefiles:
  1) gcc/4.8.1                     4) intel/2013_sp1
  2) pgi/14.2                      5) mvapich2/intel/2013_sp1/1.9
  3) slurm/2.5.7
[araim1@maya-usr1 ~]$

To view your initial list:

[araim1@maya-usr1 ~]$ module initlist 
bash initialization file /.bashrc loads modules:
	gcc pgi/14.2
	slurm 
[araim1@maya-usr1 ~]$

To remove a module from your initial list:

[araim1@maya-usr1 ~]$ module initrm pgi/14.2
Removed pgi/14.2
[araim1@maya-usr1 ~]$