IBM Support

Using Environment Modules to Manage User Environment in Platform HPC

Troubleshooting


Problem

Using Environment Modules to Manage User Environment in Platform HPC

Resolving The Problem

You may want to modify your user environment in your Platform HPC cluster. For example, you may want to use Platform MPI instead of Open MPI for running parallel jobs. To help you with this, Platform HPC includes the Environment Modules utility "module" which allows you to dynamically modify your user environment. This article describes how to use the environment module utility to manage your user environment.

This article is divided into following sections:

1. Introduction
2. Using Environment Modules
2.1 List Available Modules
2.2 List Currently Loaded Modules
2.3 Load a Modulefile
2.4 Unload a Modulefile
2.5 Show the Content of Modulefiles
2.6 Create Custom Modulefiles
2.7 Use Environment Modules with Platform LSF
3. More Information

1. INTRODUCTION

Environment Modules package "module" is a Linux shell utility that allows you to dynamically modify your user environment. Platform HPC installs and configures the module utility out-of-box. In addition it provides several module files for setting up MPI and HPC libraries such as MPICH and HDF5. This article describes what modules are available out-of-box in Platform HPC, how to use the existing modules, and how to create custom module files for your applications.

2. USING ENVIRONMENT MODULES

2.1 List Available Modules

The command to list available modules is module avail

[root@host ~]# module avail

------------------------------------------------------ /usr/share/Modules/modulefiles ------------------------------------------------------
PMPI/modulefile &# 160; linpack/linpack-openmpi-gnu mpi/mpich2-Ethernet-gnu null
blacs/blacs-openmpi-gnu module-cvs  0; mpi/mvapich-interconnects-gnu scalapack/scalapack-openmpi-gnu
dot &# 160;  0; module-info  60; mpi/mvapich2-interconnects-gnu use.own
hdf5/hdf5 &# 160; modules & #160; mpi/openmpi-interconnects-gnu

------------------------------------------------------------- /etc/modulefiles -------------------------------------------------------------
mvapich-psm-x86_64 mvapich-x86_64 mvapich2-x86_64 openmpi-x86_64

NOTE: If you have installed 3rd party Platform HPC kits, such as Mellanox or QLogic kits for InfiniBand support, you might see additional modules in the above output.

From the above output you can see that the module files are located under two locations: a) /usr/share/Modules/modulefiles and b) /etc/modulefiles. These modulefiles exist in same location on every node in you cluster.

You can get more helpful description of each module with command module whatis

[root@host ~]# module whatis
PMPI/modulefile : loads HP-MPI module
blacs/blacs-openmpi-gnu: add blacs-openmpi-gnu bin and lib directory to PATH and LD_LIBRARY_PATH
dot &# 160; : adds `.' to your PATH environment variable
hdf5/hdf5 &# 160; : add hdf5-serial bin and lib directory to PATH and LD_LIBRARY_PATH
linpack/linpack-openmpi-gnu: add linpack-openmpi-gnu bin directory to PATH
module-cvs : get most recent module sources from CVS or ftp
module-info : returns all various module-info values
modules  0; : loads the modules environment
mpi/mpich2-Ethernet-gnu: add mpich2-ethernet-gnu bin, man and lib directory to PATH, MANPATH and LD_LIBRARY_PATH
mpi/mvapich-interconnects-gnu: add platform mvapich bin, man and lib directory to PATH, MANPATH and LD_LIBRARY_PATH
mpi/mvapich2-interconnects-gnu: add mvapich2 bin, man and lib directory to PATH, MANPATH and LD_LIBRARY_PATH
mpi/openmpi-interconnects-gnu: add openmpi bin, man and lib directory to PATH, MANPATH and LD_LIBRARY_PATH
null & #160; : does absolutely nothing
scalapack/scalapack-openmpi-gnu: add scalapack-openmpi-gnu bin and lib directory to PATH and LD_LIBRARY_PATH
use.own  0; : adds your own modulefiles directory to MODULEPATH

2.2 List Currently Loaded Modules

You can list currently loaded modulefiles with command module list.

[root@host ~]# module list
Currently Loaded Modulefiles:
1) mpi/openmpi-interconnects-gnu

2.3 Load a Modulefile

To load a modulefile you need to run command moduleload.

[root@host ~]# module load mpi/openmpi-interconnects-gnu
This module will prepend the openmpi bin, man and lib directories
to the PATH, MANPATH and LD_LIBRARY_PATH environment variables respectively.

This example shows how the modulefile for Open MPI, called openmpi-interconnects-gnu, was loaded. The output of module load command also show which environment variables were updated (i.e. PATH, MANPATH and LD_LIBRARY_PATH). So, if you run which mpirun commad right now, you will see that Open MPI's mpirun is in your PATH.

[root@host ~]# which mpirun
/usr/lib64/openmpi/bin/mpirun
[root@host ~]# /usr/lib64/openmpi/bin/mpirun -V
mpirun (Open MPI) 1.4.3

NOTE: It is possible to define prerequisites for modulefiles, so that loading one modulefile can automatically load all its prerequisite modulefiles.

NOTE: It is possible to define conflicting modulefiles, so that loading one modulefile will prevent loading of the conflicting modulefile(s)

2.4 Unload a Modulefile

To unload a modulefile you need to run command module unload.

[root@host ~]# module list
Currently Loaded Modulefiles:
1) mpi/openmpi-interconnects-gnu
[root@host ~]# module unload mpi/openmpi-interconnects-gnu
[root@host ~]# module list
No Modulefiles Currently Loaded.

2.5 Show the Content of Modulefiles

To view exactly what each modulefile does, you need to use command module show:

[root@host ~]# module show mpi/openmpi-interconnects-gnu
-------------------------------------------------------------------
/usr/share/Modules/modulefiles/mpi/openmpi-interconnects-gnu:

module-whatis add openmpi bin, man and lib directory to PATH, MANPATH and LD_LIBRARY_PATH
setenv MPIHOME /usr/lib64/openmpi
prepend-path PATH /usr/lib64/openmpi/bin
setenv MANPATH /opt/lsf/7.0/man:/opt/kusu/man:/usr/share/man/overrides:/usr/share/man/en:/usr/s hare/man:/usr/local/share/man
prepend-path MANPATH /usr/share/man/openmpi-x86_64
prepend-path LD_LIBRARY_PATH /usr/lib64/openmpi/lib
conflict mpi
-------------------------------------------------------------------

This example shows that this modulefile sets two environment variables, MPIHOME and MANPATH, as well as modifies three existing environment variables by prepending additional paths to them.

2.6 Create Custom Modulefiles

The easiest way to create custom modulefiles for your applications is to copy one of the included module files and customize it to your needs. For example, you can copy the openmpi-interconnects-gnu and then change the setenv and prepend-path lines to be specific to your application. Your custom modulefiles must be located in one of three locations:

  • /usr/share/Modules/modulefiles
  • /etc/modules/
  • $HOME/privatemodules

The $HOME/privatemodules directory does not initially exist in you home directory. You will need to use create it first, and place your modulefiles there. In addition, you need to load use.own modulefile to tell the module command to search for your modules there.

2.7 Use Environment Modules with Platform LSF

If you are submitting a serial job LSF, then it is only necessary to prepare your user environment on the submission host, i.e. the PCM Installer node. This is because LSF will copy your environment to the execution host.

However, if you are submitting a parallel job that will span across multiple hosts, you must tell LSF to prepare the environment on each host, prior to executing the job. You do this by including module load command in your LSF submission script.

3. MORE INFORMATION

Environment Modules is an open source project hosted at sourceforge.net: http://modules.sourceforge.net/. You cand find more information, including documentation and man pages on this site.

Module help menu is available via module -H

[root@host ~]# module -H


[{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"--","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"3.0","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}},{"Product":{"code":"SSZUCA","label":"IBM Spectrum Cluster Foundation"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":null,"Platform":[{"code":"","label":""}],"Version":"","Edition":"","Line of Business":{"code":"LOB10","label":"Data and AI"}}]

Document Information

More support for:
IBM Spectrum Cluster Foundation

Software version:
3.0

Document number:
702801

Modified date:
16 September 2018

UID

isg3T1014792