Environment Modules
Environment modules allow you to easily load and unload software for use on the cluster.
Basic Commands
module avail
Show all available modules
module add <module>
Adds a module to your environment for this session
module initadd <module>
Configure module to be loaded at every login
module rm <module>
or module unload
Removes a module that is currently loaded
module purge
Removes all modules that are currently loaded
module help
Provides some simple information about a module
Example
By default the GNU gcc compiler and the slurm Workload manager are loaded. If we want to use the intel compiler instead of the gcc compiler we can use the following:
[user.name@hodor ~]$ module list Currently Loaded Modulefiles: 1) gcc/6.1.02) slurm/16.05.8 [user.name@hodor ~]$ module rm gcc [user.name@hodor ~]$ module list Currently Loaded Modulefiles: 1) slurm/16.05.8 [user.name@hodor ~]$ module load intel/compiler/64 [user.name@hodor ~]$ module list Currently Loaded Modulefiles: 1) slurm/16.05.82) intel/compiler/64/16.0.4/2016.4.258
When this is done the various environment variables that are required to use the intel compiler will be loaded.
Currently Available Modules On The Cluster
Below is the list of currently Available modules:
____ /cm/local/modulefiles ____ 1.49intel/mic/runtime/3.8.3 cluster-tools/7.3intel/mic/sdk/3.8.3 cluster-tools-dell/7.3ipmitool/1.8.17 cmdlog4perl/1.49 cm-scale-cluster/7.3module-git cmshmodule-info dotnull freeipmi/1.5.2openldap gcc/6.1.0shared ____ /cm/shared/modulefiles ____ acml/gcc/64/5.3.1 acml/gcc/fma4/5.3.1 acml/gcc/mp/64/5.3.1 acml/gcc/mp/fma4/5.3.1 acml/gcc-int64/64/5.3.1 acml/gcc-int64/fma4/5.3.1 acml/gcc-int64/mp/64/5.3.1 acml/gcc-int64/mp/fma4/5.3.1 acml/open64/64/5.3.1 acml/open64/fma4/5.3.1 acml/open64/mp/64/5.3.1 acml/open64/mp/fma4/5.3.1 acml/open64-int64/64/5.3.1 acml/open64-int64/fma4/5.3.1 acml/open64-int64/mp/64/5.3.1 acml/open64-int64/mp/fma4/5.3.1 blacs/openmpi/gcc/64/1.1patch03 blacs/openmpi/open64/64/1.1patch03 blas/gcc/64/3.6.0 blas/open64/64/3.6.0 bonnie++/1.97.1 cmake/3.9.6 cmgui/7.3 cuda75/blas/7.5.18 cuda75/fft/7.5.18 cuda75/nsight/7.5.18 cuda75/profiler/7.5.18 cuda75/toolkit/7.5.18 default-environment fftw2/openmpi/gcc/64/double/2.1.5 fftw2/openmpi/gcc/64/float/2.1.5 fftw2/openmpi/open64/64/double/2.1.5 fftw2/openmpi/open64/64/float/2.1.5 fftw3/openmpi/gcc/64/3.3.4 fftw3/openmpi/open64/64/3.3.4 gdb/7.11 globalarrays/openmpi/gcc/64/5.4 globalarrays/openmpi/open64/64/5.4 hdf5_18/1.8.17 hpl/2.2 hwloc/1.11.3 intel/compiler/32/16.0.4/2016.4.258 intel/compiler/64/16.0.4/2016.4.258 intel/daal/64/2016.4/2016.4.258 intel/gdb/32/7.8.0/2016.4.258 intel/gdb/64/7.8.0/2016.4.258 intel/ipp/32/9.0.4/2016.4.258 intel/ipp/64/9.0.4/2016.4.258 intel/mkl/32/11.3.4/2016.4.258 intel/mkl/64/11.3.4/2016.4.258 intel/mkl/mic/11.3.4/2016.4.258 intel/mpi/32/16.0.4/2016.4.258 intel/mpi/64/5.1.3/2016.4.258 intel/mpi/mic/5.1.3/2016.4.258 intel/tbb/32/4.4.6/2016.4.258 intel/tbb/64/4.4.6/2016.4.258 intel/tbb/mic/4.4.6/2016.4.258 intel-cluster-runtime/ia32/3.8 intel-cluster-runtime/intel64/3.8 intel-cluster-runtime/mic/3.8 intel-tbb-oss/ia32/2017_20170807oss intel-tbb-oss/intel64/2017_20170807oss iozone/3_434 lapack/gcc/64/3.6.0 lapack/open64/64/3.6.0 libstdc++-devel/4.8.5-11 libstdc++-devel.i686/4.8.5-11 libstdc++-static/4.8.5-11 libstdc++-static.i686/4.8.5-11 log4perl/1.49 mpich/ge/gcc/64/3.2rc2 mpich/ge/open64/64/3.2rc2 mpiexec/0.84_432 mvapich2/gcc/64/2.2rc1 mvapich2/open64/64/2.2rc1 netcdf/gcc/64/4.4.0 netcdf/intel/64/4.4.0 netcdf/open64/64/4.4.0 netperf/2.7.0 open64/4.5.2.1 openblas/dynamic/0.2.18 openlava/3.3.3 openmpi/gcc/64/1.10.1 openmpi/open64/64/1.10.1 python/2.6.9 scalapack/openmpi/gcc/64/2.0.2 sge/2011.11p1 SHARPpy/1.3.0 slurm/16.05.8 torque/6.0.2
Making Your Own Modulefiles
If you have programs that you built in a directory on your account you can create a modulefile to simplify the process of loading it.
First create a directory where you will store your module files. In this example we
will use a hidden directory .personalModulefiles
mkdir ~/.personalModulefiles
Next we will need to add this directory to the locations where the environment modules
are found. To do this we will use: module use /home/first.last/.personalModulefiles
If you want to have this directory added to the list automatically when you login, you can run this command (after entering your username) to have it added to your .bashrc which will load on login.
echo "module use /home/first.last/.personalModulefiles" >> ~/.bashrc
Now that we have added the personalModfiles directory to the modulefiles search path, we can start to add our own modulefiles in this folder. Modulefiles for the UND clusters are written in the tcl language.
This is an example of a modulefile used to load the mpi version of dl_poly. We will
save it in a subfolder dl_poly
with the name 4.08-mpi
. This give us the path /home/first.last/.personalModulefiles/dl_poly/4.08-mpi
:
#%Module -*- tcl -*- ## ## dot modulefile ## ## The next two sections provide information about the module when you run the module help commands. proc ModulesHelp { } { puts stderr "\tAdds DL_POLY 4.08-mpi to your environment variables," } module-whatis "Adds DL_POLY 4.08-mpi to your environment variables" ## This will load another module when this one is loaded for example the mpich module. if { [ module-info mode load ] } { module load mpich/ge/gcc } ## This part sets some variables. setdl_poly_version4.08-mpi setroot/home/first.last/path_to_dl_poly/$dl_poly_version ## Finally the path is appended to with the location that was provided by the variables. prepend-pathPATH$root/bin
Now when you run module avail
you should see the new module listed
______ /home/first.last/.personalModfiles ______ dl_poly/4.08-mpi ______ /cm/local/modulefiles ______ . . .
You can load this module just like you would any other module
module load dl_poly/4.08-mpi
If your new module doesn't show up when you run module avail
, make sure you have #%Module -*- tcl -*-
on the first line of your module file.
More Information
For further reading on environment variables and environment modules:
- https://en.wikipedia.org/wiki/Environment_variable
- https://en.wikipedia.org/wiki/Environment_Modules_%28software%29
If you need assistance using module files on any of the UND clusters contact us