Modules at HPRC
Modules provide a quick and convenient way to setup a user's environment via a set of prebuilt configurations. Currently teal, fenn, and huff offer support for the use of modules for both interactive and batch jobs. The examples below will use teal as the sample machine. First, lets look at the common commands used to interact with modules.
Common Commands
module list | List currently loaded modules. |
module use | Access Module not available by default these can include your own modules and the Intel Compiler modules |
module avail | List available packages. |
module spider | List available packages in a different format. |
module help [modulefile] | Description of specified module. |
module show [modulefile] | Displays information about specified module, including environment changes, dependencies, software version and path. |
module load [modulefile] | Loads module or specifies which dependencies have not been loaded. |
module unload [modulefile] | Unloads specified module from environment. |
module purge | Unloads all loaded modules |
Command Examples
module list
[jmdavis@teal ~]$ module listNo modules loaded
module use
Access Module not available by default these can include your own modules and the Intel Compiler modules.
[jmdavis@teal81 ~]$ module use /home1/global/intelone/modulefiles
[jmdavis@teal81 ~]$ module avail--------------------------------------------------- /home1/global/intelone/modulefiles --------------------------------------------------- advisor/latest debugger/latest icc32/2021.4.0 (D) mkl/2021.4.0 (D) advisor/2021.4.0 (D) debugger/10.1.1 init_opencl/latest mkl32/latest ccl/latest debugger/10.2.4 (D) init_opencl/2021.2.0 mkl32/2021.2.0 ccl/2021.2.0 dev-utilities/latest init_opencl/2021.4.0 (D) mkl32/2021.4.0 (D) ccl/2021.4.0 (D) dev-utilities/2021.2.0 inspector/latest mpi/latest clck/latest dev-utilities/2021.4.0 (D) inspector/2021.4.0 (D) mpi/2021.2.0 clck/2021.2.0 dnnl-cpu-gomp/latest intel_ipp_ia32/latest mpi/2021.4.0 (D) clck/2021.4.0 (D) dnnl-cpu-gomp/2021.4.0 (D) intel_ipp_ia32/2021.2.0 oclfpga/latest compiler-rt/latest dnnl-cpu-iomp/latest intel_ipp_ia32/2021.4.0 (D) oclfpga/2021.2.0 compiler-rt/2021.2.0 dnnl-cpu-iomp/2021.4.0 (D) intel_ipp_intel64/latest oclfpga/2021.4.0 (D) compiler-rt/2021.4.0 (D) dnnl-cpu-tbb/latest intel_ipp_intel64/2021.2.0 tbb/latest compiler-rt32/latest dnnl-cpu-tbb/2021.4.0 (D) intel_ipp_intel64/2021.4.0 (D) tbb/2021.2.0 compiler-rt32/2021.2.0 dnnl/latest intel_ippcp_ia32/latest tbb/2021.4.0 (D) compiler-rt32/2021.4.0 (D) dnnl/2021.4.0 (D) intel_ippcp_ia32/2021.2.0 tbb32/latest compiler/latest dpct/latest intel_ippcp_ia32/2021.4.0 (D) tbb32/2021.2.0 compiler/2021.2.0 dpct/2021.2.0 intel_ippcp_intel64/latest tbb32/2021.4.0 (D) compiler/2021.4.0 (D) dpct/2021.4.0 (D) intel_ippcp_intel64/2021.2.0 vpl/latest compiler32/latest dpl/latest intel_ippcp_intel64/2021.4.0 (D) vpl/2021.2.2 compiler32/2021.2.0 dpl/2021.2.0 itac/latest vpl/2021.6.0 (D) compiler32/2021.4.0 (D) dpl/2021.5.0 (D) itac/2021.2.0 vtune/latest dal/latest icc/latest itac/2021.4.0 (D) vtune/2021.7.1 (D) dal/2021.2.0 icc/2021.4.0 (D) mkl/latest dal/2021.4.0 (D) icc32/latest mkl/2021.2.0-------------------------------------------------------- /usr/global/modulefiles --------------------------------------------------------- OpenFoam10 devtoolset/7 devtoolset/10 gcc/5.5.0 gcc/9.3.1 matlab/R2019b openmpi4 R/4.1.3 devtoolset/8 devtoolset/11 (D) gcc/7.3.1 gcc/10.2.1 matlab/R2021a (D) cmake3.22 devtoolset/9 gaussian16 gcc/8.3.1 gcc/11.2.1 (D) openfoam8------------------------------------------------------------ /etc/modulefiles ------------------------------------------------------------ mpi/openmpi-x86_64------------------------------------------------- /usr/share/lmod/lmod/modulefiles/Core -------------------------------------------------- lmod settarg Where: D: Default ModuleUse "module spider" to find all possible modules and extensions.Use "module keyword key1 key2 ..." to search for all possible modules matching any of the "keys".
module avail
List available packages.
[jmdavis@teal ~]$ module avail--------------------------- /usr/global/modulefiles ---------------------------- cmake3.22 devtoolset/10 (D) gcc/9.3.1 openfoam8 devtoolset/7 gaussian16 gcc/10.2.1 (D) openmpi4 devtoolset/8 gcc/7.3.1 matlab/R2019b devtoolset/9 gcc/8.3.1 matlab/R2021a (D)------------------------------- /etc/modulefiles ------------------------------- mpi/openmpi-x86_64-------------------- /usr/share/lmod/lmod/modulefiles/Core --------------------- lmod settarg Where: D: Default Module
module spider
List available packages in a different format.
[jmdavis@teal ~]$ module spider----------------------------------------------------------------------------The following is a list of the modules and extensions currently available:----------------------------------------------------------------------------cmake3.22: cmake3.22devtoolset: devtoolset/7, devtoolset/8, devtoolset/9, devtoolset/10gaussian16: gaussian16gcc: gcc/7.3.1, gcc/8.3.1, gcc/9.3.1, gcc/10.2.1lmod: lmodLmod: An Environment Module Systemmatlab: matlab/R2019b, matlab/R2021ampi: mpi/openmpi-x86_64openfoam8: openfoam8openmpi4: openmpi4settarg: settarg----------------------------------------------------------------------------To learn more about a package execute:$ module spider Foowhere "Foo" is the name of a module.To find detailed information about a particular package youmust specify the version if there is more than one version:$ module spider Foo/11.1----------------------------------------------------------------------------
module help [modulefile]
If a help file has been created for the module it will be displayed.
[jmdavis@teal ~]$ module help gcc
-------------------- Module Specific Help for "gcc/10.2.1" ---------------------
module show [modulefile]
Will show the contents of the modulefile.
[jmdavis@teal ~]$ module show gcc---------------------------------------------------------------------------- /usr/global/modulefiles/gcc/10.2.1:----------------------------------------------------------------------------prepend_path("INFOPATH","/opt/rh/devtoolset-10/root/usr/share/info")prepend_path("LD_LIBRARY_PATH","/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib:/opt/rh/devtoolset-10/root/usr/lib64/dyninst:/opt/rh/devtoolset-10/root/usr/lib/dyninst:/opt/rh/devtoolset-10/root/usr/lib64:/opt/rh/devtoolset-10/root/usr/lib")prepend_path("MANPATH","/opt/rh/devtoolset-10/root/usr/share/man")prepend_path("PATH","/opt/rh/devtoolset-10/root/usr/bin")prepend_path("PKG_CONFIG_PATH","/opt/rh/devtoolset-10/root/usr/lib64/pkgconfig")setenv("PCP_DIR","/opt/rh/devtoolset-10/root")
module load [modulefile]
Loads a module into your environment for use. This can be done interactively or in a job submission script for SGE or slurm.
[jmdavis@teal ~]$ module load gcc
To make sure the module was loaded, you can use "module list"
[jmdavis@teal ~]$ module listCurrently Loaded Modules: 1) gcc/10.2.
module unload [modulefile]
Unloads a particular module. This can be checked with "module list" as well.
[jmdavis@teal ~]$ module unload gcc[jmdavis@teal ~]$ module listNo modules loaded
module purge
Unloads all modulefiles currently in your environment. This is a good command to use in a script where you want to insure that only needed modules are loaded to avoid potential conflicts.
[jmdavis@teal ~]$ module load devtoolset/9 openmpi4[jmdavis@teal ~]$ module listCurrently Loaded Modules: 1) devtoolset/9 2) openmpi4[jmdavis@teal ~]$ module purge[jmdavis@teal ~]$ module listNo modules loaded
Scripts and Batch Commands
To ensure that modules are loaded correctly within a script file add -l option to the first line of your script, i.e.:
#!/bin/bash -l
When including modules in scripts and batch submission commands (via qsub), it is the best practice to specify modules and applications by version number. Over time, newer versions of the applications will be installed. Specifying versions of applications ensures that in the future jobs will run the same way as they do now.
For example if you built something using gcc/7.3.1 you would want to specify it in your module load.
[jmdavis@teal ~]$ module avail gcc--------------------------- /usr/global/modulefiles ---------------------------- gcc/7.3.1 gcc/8.3.1 gcc/9.3.1 gcc/10.2.1 (D) Where: D: Default Module
[jmdavis@teal ~]$ module load gcc/7.3.1[jmdavis@teal ~]$ module listCurrently Loaded Modules: 1) gcc/7.3.1
While it is possible to add module commands to your startup environment. HPRC strongly recommends that you do not do so. You may find conflicts later when you want to use different modules. It is best to add the module load commands to your scripts.