Environment modules (Lmod)#
What are Environment Modules?#
Software in Eureka, Eureka2, KARA02 and MARCH clusters is managed by, and made accessible with, Environment modules (Lmod). It enables dynamic modification of your environment to make software, libraries and applications available for you to use.
Environment modules allow users access to multiple different versions of software packages libraries and compilers that would ordinarily conflict with each other if natively installed on a system (via a package manager like yum/dnf or apt).
“Environment Modules provide a convenient way to dynamically change the users’ environment through modulefiles. This includes easily adding or removing directories to the PATH environment variable. A modulefile contains the necessary information to allow a user to run a particular application or provide access to a particular library. All of this can be done dynamically without logging out and back in. Modulefiles for applications modify the user’s path to make access easy. Modulefiles for Library packages provide environment variables that specify where the library and header files can be found.
Packages can be loaded and unloaded cleanly through the module system. All the popular shells are supported: bash, ksh, rc, csh, tcsh, fish, zsh. Also available for perl, python, lisp, cmake, and R.
It is also very easy to switch between different versions of a package or remove it.”
Listing available software#
To see all available modules, run module avail
[abc123@login7(eureka) ~]$ module avail
------------------------------------ /opt/pkg/modulefiles ------------------------------------------------------
R/3.5.2 (D) freesurfer/6.0.0 (D)
anaconda2/4.3.1 glib/2.12.1
anaconda3/4.3.1 hdf5/1.10.1+intel-xe_2017_3
castep/16.1.1/gcc-4.8.5+intel-xe_2015_6+openmpi-1.10 lammps/2017/mpi+intel-xe_2016_4
castep/17.2.1/gcc-4.8.5+intel-xe_2016_4+openmpi-1.10+avx lammps/2018/mpi+intel-xe_2017_3
castep/17.2.1/gcc-4.8.5+intel-xe_2016_4+openmpi-1.10 (D) platformmpi/9.1
freesurfer/5.3.0
————————————————————————————————— /opt/proprietary-apps/modulefiles ----------------------------------
ansys/18.0 lsdyna/hybrid-double-9.1+platformmpi-9.1 lsdyna/smp-single-10.1 (D)
gamess-uk/8.2 lsdyna/hybrid-single-9.1+platformmpi-9.1 lsopt/5.2.1
gaussian/09 lsdyna/hybrid-single-10.0+platformmpi-9.1 matlab/R2012a-CR
intel/Intel_Parallel_Suite/xe_2015_6 lsdyna/mpp-double-latest.dev+platformmpi-9.1 matlab/R2017a (D)
intel/Intel_Parallel_Suite/xe_2016_4 lsdyna/mpp-double-10.0+platformmpi-9.1 vasp/5.4.4-intel2017a
intel/Intel_Parallel_Suite/xe_2017_3 (D) lsdyna/mpp-single-10.0+platformmpi-9.1 vasp/5.4.4 (D)
-------------------------------- /opt/eb-pkg/ebadmin/modules/all ------------------------------------------------
ACTC/1.1-intel-2016a damageproto/1.2.1-intel-2016a
Autoconf/2.69-foss-2016b eudev/3.1.5-intel-2016a
Autoconf/2.69-GCCcore-6.3.0 expat/2.1.0-intel-2016a
Autoconf/2.69-intel-2016a expat/2.1.1-intel-2016a
Autoconf/2.69 (D) expat/2.2.0-foss-2016b
Automake/1.15-foss-2016b expat/2.2.0-GCCcore-6.3.0
Automake/1.15-GCCcore-6.3.0 expat/2.2.0-intel-2016a (D)
Using a software package#
Loading an environment module#
To use a particular software package you will need to load its environment module with the module load <modulename> command.
# Loading up the Intel_Parallel_Suite/xe_2017_3 compiler module.
[abc123@login7(eureka) ~]$ module load intel/Intel_Parallel_Suite/xe_2017_3
# Loading up the Lammps 2018.
[abc123@login7(eureka) ~]$ module load lammps/2018/mpi+intel-xe_2017_3
# Loading up cp2k version 6.1 openmp.
[abc123@login7(eureka) ~]$ module load cp2k/6.1-openmp
Show currently loaded modules#
To see what modules are loaded, run module list.
[abc123@login7(eureka) ~]$ module list
Currently Loaded Modules:
1) lammps/2018/mpi+intel-xe_2017_3 2) intel/Intel_Parallel_Suite/xe_2017_3 3) cp2k/6.1-openmp
Caution
Sometimes additional modules may get loaded that you didn’t expect, these are dependencies
e.g. Loading up lammps/2018/mpi+intel-xe_2017_3 will also load up intel/Intel_Parallel_Suite/xe_2017_3
since it needs its mpi libraries available to execute.
Check a module has loaded correctly#
To check a module has loaded an executable, run which <executable>.
You can check a module has loaded properly by checking if the correct executable has been made available.
[abc123@login7(eureka) ~]$ module load lammps/2018/mpi+intel-xe_2017_3
[abc123@login7(eureka) ~]$ which lmp_intel_cpu_intelmpi
/opt/pkg/apps/lammps/2018-mpi/src/lmp_intel_cpu_intelmpi
[abc123@login7(eureka) ~]$ module load intel/Intel_Parallel_Suite/xe_2017_3
[abc123@login7(eureka) ~]$ which icc
/opt/proprietary-apps/Intel_Parallel_Suite/xe_2017_3/compilers_and_libraries_2017.3.191/linux/bin/intel64/icc
Unloading a module#
To unload a particular module, run module unload <modulename>.
# Unloading Intel_Parallel_Suite/xe_2017_3.
[abc123@login7(eureka) ~]$ module unload intel/Intel_Parallel_Suite/xe_2017_3
# Unloading Lammps 2018.
[abc123@login7(eureka) ~]$ module unload lammps/2018/mpi+intel-xe_2017_3
# Unloading cp2k version 6.1 openmp.
[abc123@login7(eureka) ~]$ module unload cp2k/6.1-openmp
Unloading all modules#
To unload ALL modules loaded, run module purge.
[abc123@login7(eureka) ~]$ module list
Currently Loaded Modules:
1) lammps/2018/mpi+intel-xe_2017_3 2) intel/Intel_Parallel_Suite/xe_2017_3 3) cp2k/6.1-openmp
[abc123@login7(eureka) ~]$ module purge
[abc123@login7(eureka) ~]$ module list
No modules loaded
Check the status of a module#
To show what a module is doing, run module show <modulename>.
[abc123@login7(eureka) ~]$ module show lammps/2018/mpi+intel-xe_2017_3
--------------------------------------------------------------------------------------------------
/opt/pkg/modulefiles/lammps/2018/mpi+intel-xe_2017_3:
--------------------------------------------------------------------------------------------------
whatis(" Adds lammps (mpi) version 2018 to your environment variables ")
prepend_path("PATH","/opt/pkg/apps/lammps/2018-mpi")
prepend_path("PATH","/opt/pkg/apps/lammps/2018-mpi/src")
load("intel/Intel_Parallel_Suite/xe_2017_3")
help([[ Adds lammps (mpi) version 2018 to your environment variables
]])
Using module “collections”#
Module collections are used to automatically load a set of modules while also preserving the order in which they are loaded.
To save a “collection” of modules in their correct “load order” run the commands below. This will create a “default” collection.
First load all the necessary modules in the right order, then run:
module saveTo restore the “default” collection in future and auto-load in the right order, run:
module restore
You can also create “non-default” module collections with a custom names.
Load all the necessary modules in the right order, then run:
module save <collection_name>To restore the above created module collection run:
module restore <collection_name>
List all the modules in a collection with:
module describe <collection_name>
List all of your module collections with:
module savelist
Compilers and libraries#
When using compilers and libraries, consistency is required. Random libraries, compilers and software cannot be put together.
For example when using GCC compilers and using a library with it, the library must also be compiled by the same GCC compiler version. It cannot be used with a library compiled with another compiler such as intel or GCC of a different version.
So in the example below, a gfortran compiler can compile code against the HDF5 library which was compiled with gfortran. However, the Intel compiler cannot compile code against the HDF5 library which was compiled with GCC.
If the in HDF5 library was compiled with intel, the intel compiler would be able to compile code against the HDF5 library which was compiled with Intel.