User Tools

Site Tools


using_software_modules

Using Software Modules

Many HPC systems support multiple libraries and library versions. For instance, by default, HPC Limulus systems support both Open MPI (Message Passing Interface) and MPICH. Each of these packages provides the MPI API for programmers and applications. These libraries are supplied as RPM packages as part of the OpenHPC distribution.

To help manage multiple packages on a cluster, the lmod package is a convenient way to dynamically change the users’ environment through modulefiles. This includes easily adding or removing directories to or from the PATH environment variable. Modulefiles for library packages provide environment variables that specify where the library and header files can be found.

Thus, a user can quickly move between various library “environments” by simply using the lmod package.

All OpenHPC or Limulus user libraries are installed with pre-configured modulefiles. System administrators can create modulefiles for custom packages that are built and installed outside of the OpenHPC or Limulus RPM trees.

Simple Example

All Linux distributions come with GNU C compilers. While the versions of these compilers are “current” they are usually not “new” and may not support some advanced processors or offer better optimization. For instance, the current version of OpenHPC installs version 8.3 GNU compilers (C, C++, Fortran) in /opt/ohpc/pub/compiler/gcc/8.3.0/bin. It does not replace the existing “distribution” compilers (version 4.8.5) located in /usr/bin.

By default, OpenHPC uses modules to point to the version 8.3 GNU compilers. This setting can be confirmed by entering:

$ which gcc
/opt/ohpc/pub/compiler/gcc/8.3.0/bin/gcc

Note: All OpenHPC libraries are stored under /opt/ohpc. The current compiler version can be confirmed with the following command:

$ gcc --version
gcc (GCC) 8.3.0
Copyright ...

If the gnu8 module is removed using the lmod module command, then the default “system” compilers will be used. For example:

$ module rm gnu8

Inactive Modules:
  1) openmpi3

Ignoring the “Inactive Modules” message for the moment, the path and version of the default GNU compilers can be shown as follows:

$ which gcc
/bin/gcc

$ gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-39)
Copyright ...

The current default compilers are those installed by the CentOS distribution. The GNU 8 compiler module can be re-loaded by issuing the following:

$ module load gnu8

Activating Modules:
  1) openmpi3/3.1.4

Quick Start

The following are some quick examples of how the module command is used.

What Modules are Available

$ module avail

----------------------------------------------- /opt/ohpc/pub/moduledeps/gnu8 -----------------------------------------------
   mpich/3.3.1    openmpi3/3.1.4 (L)

------------------------------------------------- /opt/ohpc/pub/modulefiles -------------------------------------------------
   cmake/3.15.4    gnu8/8.3.0 (L)    ohpc (L)    pmix/2.2.2    prun/1.3 (L)

  Where:
   L:  Module is loaded

Use "module spider" to find all possible modules.
Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".

Swap the MPI Libaries

The following example checks the path to the current mpicc wrapper function and then swaps the MPI version from Open MPI to MPICH.

$ which mpicc
/opt/ohpc/pub/mpi/openmpi3-gnu8/3.1.4/bin/mpicc

$ module swap openmpi3 mpich/3.3.1

$ which mpicc
/opt/ohpc/pub/mpi/mpich-gnu8-ohpc/3.3.1/bin/mpicc
using_software_modules.txt · Last modified: 2021/04/28 14:36 by brandonm