The module command sets the appropriate environment variables to assist you running application. You can use it within the shell command line or job submission script.
- Due to historical reasons, there are two module system available on Turing cluster. The original module system should not be used unless a spcific software built before 2016 is required.
- To be compatible with scripts created by some of our long term users, the original module system is still loaded by default.
All user should use
enable_lmod
to switch to modern module system, unless otherwise instructed.
$ enable_lmod
When use this command on Wahab, it will be simply ignoredDO NOT FORGET
enable_lmod
To list the modules currently loaded:
$ module list
To find out all available modules to load:
$ module avail
It is also possible to search with module avail command:
$ module avail cc
To load packages:
$ module load package1 package2 ...
To unload packages:
$ module unload package1 package2 ...
On Turing cluster, some modules come with additional help information:
$ module help packageName
On Turing cluster, a short description is available for modules:
$ module whatis gcc
Another way to search for modules is with the "module spider" command. Spider searches all modulefiles rather than the current hierarchy. To learn more about Module Hierarchy, please continue reading.
$ module spider gcc
Every module set following environment variables.
For example:
$ module load gcc openmpi netcdf
# You can ignore the version. It loads the latest version of each the package.
$ env | grep ^NETCDF
NETCDF_ROOT=/cm/shared/applications/netcdf/4.4.1/gcc-6
NETCDF_VER=4.4
NETCDF_VERSION=4.4.1
# useful when compiling code:
$ gcc -I$NETCDF_ROOT/include source.c
$ gcc -L$NETCDF_ROOT/lib -lnetcdf source.o
Module Hierarchy solves a very simple problem. Please take a look at the legacy module work flow:
# Legacy Mode:
$ module avail gcc
---------------------------- /cm/shared/modulefiles ----------------------------
gcc/4.8.4 gcc/4.9.0 gcc/5.4.0
gcc/4.8.5 gcc/4.9.3 gcc/6.1.0
gcc/4.8.5-no-qm gcc/5.3.0 gcc/6.2.0
$ module avail openmpi
---------------------------- /cm/shared/modulefiles ----------------------------
openmpi/gcc/64/1.10.2 openmpi/icc/64/1.6.5
openmpi/gcc/64/1.6.5 openmpi/open64/64/1.6.5
openmpi/gcc/64/4.9.3/1.10.2 openmpi/openacc/64/1.6.5
openmpi/gcc/64/6.1.0/1.10.2
$ module avail netcdf
---------------------------- /cm/shared/modulefiles ----------------------------
netcdf/gcc/64/4.3.1.1 netcdf/gcc/64/6.1/4.4.0 netcdf/open64/64/4.3.1.1
netcdf/gcc/64/4.3.3.1 netcdf/gcc/64/6.1/4.4.1 netcdf/open64/64/4.3.3.1
netcdf/gcc/64/4.9/4.4.0 netcdf/gcc/64/test
netcdf/gcc/64/5.4/4.4.1 netcdf/intel/64/4.4.0
You want to load gcc/4.9.3, openmpi/1.10.2, and netcdf/4.4.0. You can use the following commmand both on the command line or in job submission scripts.
# Legacy Mode:
$ module load gcc/4.9.3
$ module load openmpi/gcc/64/4.9.3/1.10.2
$ module load netcdf/gcc/64/4.9/4.4.0
If you wish to load gcc/6.1 instead, you need to modify your scripts three times as follows:
# Legacy Mode:
$ module unload gcc/4.9.3
$ module unload openmpi/gcc/64/4.9.3/1.10.2
$ module unload netcdf/gcc/64/4.9/4.4.0
# above steps can be ignored if used in script
$ module load gcc/6.1.0
$ module load openmpi/gcc/64/6.1.0/1.10.2
$ module load netcdf/gcc/64/6.1/4.4.0
This creates unnecessary work and introduces space for low level mistakes to happen. For instance, if you forgot to modify one of those lines, you may encounter some odd errors much later. For instance:
Fatal Error: Cannot read module file 'netcdf.mod' opened at (1),
because it was created by a different version of GNU Fortran
To make your life easier, we introduced Lmod with Module Hierarchy. Let's take a look at the work flow:
First enable Lmod
$ enable_lmod
Check availability of gcc, openmpi and netcdf (optional):
$ module spider gcc
----------------------------------------------------------------------------------------------------------------------
gcc:
----------------------------------------------------------------------------------------------------------------------
Description:
The GNU Compiler Suit and Support Files
Versions:
gcc/4
gcc/5
gcc/6
----------------------------------------------------------------------------------------------------------------------
For detailed information about a specific "gcc" module (including how to load the modules) use the module's full name.
For example:
$ module spider gcc/6
----------------------------------------------------------------------------------------------------------------------
$ module spider openmpi
----------------------------------------------------------------------------------------------------------------------
openmpi:
----------------------------------------------------------------------------------------------------------------------
Description:
A powerful implementation of MPI
Versions:
openmpi/2.0
----------------------------------------------------------------------------------------------------------------------
For detailed information about a specific "openmpi" module (including how to load the modules) use the module's full name.
For example:
$ module spider openmpi/2.0
----------------------------------------------------------------------------------------------------------------------
$ module spider netcdf
----------------------------------------------------------------------------------------------------------------------
netcdf:
----------------------------------------------------------------------------------------------------------------------
Description:
Libraries for the Unidata network Common Data Form (NetCDF)
Versions:
netcdf/4.4
----------------------------------------------------------------------------------------------------------------------
For detailed information about a specific "netcdf" module (including how to load the modules) use the module's full name.
For example:
$ module spider netcdf/4.4
----------------------------------------------------------------------------------------------------------------------
Check detailed information regarding any package (optional):
$ module spider netcdf/4.4
----------------------------------------------------------------------------------------------------------------------
netcdf: netcdf/4.4
----------------------------------------------------------------------------------------------------------------------
Description:
Libraries for the Unidata network Common Data Form (NetCDF)
You will need to load all module(s) on any one of the lines below before the "netcdf/4.4" module is available to load.
gcc/4
gcc/5
gcc/6
icc/17
pgi/16
Help:
Module Purpose
-------
This module file defines the system paths and environment variables
needed to use netcdf version 4.4.1.
Module Description
-------
NetCDF is a set of software libraries and self-describing, machine-independent
data formats that support the creation, access, and sharing of array-oriented
scientific data. NetCDF was developed and is maintained at Unidata. Unidata
provides data and software tools for use in geoscience education and research.
Unidata is part of the University Corporation for Atmospheric Research (UCAR)
Community Programs (UCP). Unidata is funded primarily by the National Science
Foundation.
Additional Information
-------
For more information about netcdf, see the following URL:
http://www.unidata.ucar.edu/software/netcdf/
http://www.unidata.ucar.edu/software/netcdf/docs/
Updated at 21 Jun 2016
Load modules:
$ module load gcc/4
$ module load openmpi/2.0
$ module load netcdf/4.4
$ module list
Currently Loaded Modules:
1) gcc/4 2) netcdf/4.4 3) openmpi/2.0
As you can see, each module path becomes much shorter and it loaded the correct package for you.
You can verify it as below:
$ which gcc
/cm/shared/applications/gcc/4.9.4/bin/gcc
$ which mpicc
/cm/shared/applications/openmpi/2.0.1/gcc-4/bin/mpicc
$ which nf-config
/cm/shared/applications/netcdf/4.4.1/gcc-4/bin/nf-config
Now, let's say you want to switch to use gcc 6.2.
All you need to do is below:
$ module load gcc/6
Due to MODULEPATH changes, the following have been reloaded:
1) netcdf/4.4 2) openmpi/2.0
The following has been reloaded with a version change:
1) gcc/4 => gcc/6
$ module list
Currently Loaded Modules:
1) gcc/6 2) netcdf/4.4 3) openmpi/2.0
You can verify it below:
$ which gcc
/cm/shared/applications/gcc/6.2.0/bin/gcc
$ which mpicc
/cm/shared/applications/openmpi/2.0.1/gcc-6/bin/mpicc
$ which nf-config
/cm/shared/applications/netcdf/4.4.1/gcc-6/bin/nf-config
As you can see, just simply type module load gcc/6
. The Lmod module command will automatically unload old packages and load new packages with correct dependencies.