Using Modules to Manage Access to Software
On mimi, users should not have to modify their path directly. Instead, the module utility is used to set environment variables for software and libraries, including a lot of software that is loaded by default. Simply ``load'' and ``unload'' modules to control your environment.
Modules environment management package provides support for dynamic modification of the user environment via modulefiles. Each modulefile contains all the information needed to configure the shell for a particular application. Typically, a modulefile modifies environment variables like PATH, MANPATH, LD_LIBRARY_PATH and XXXX_HOME (where XXX is the name of a software/library in capital letter) to give access to an application or library.
Command | Description |
---|---|
module list | Lists modules currently loaded in a user’s environment |
module avail | Lists all available modules on a system in condensed format |
module avail | Lists all available modules on a system in long format |
module display | Shows environment changes that will be made by loading a given module |
module load | Loads a module |
module unload | Unloads a module |
module help | Shows help for a module |
module swap | Swaps a currently loaded module for an unloaded module |
What is loaded now?
[mimi ~]$ module list Currently Loaded Modulefiles: 1) geosciences 2) use.own
What is available?
To see which modulefiles are available on your system, enter this command:
[mimi ~]$ module avail [string]
The module avail command produces an alphabetical listing of every modulefile in your module use path and has no option for "grepping." Therefore, it is usually more useful to use the command with an string argument:
[mimi ~]$ module avail python ---------------------------------------------------- /opt/software/easybuild/modules/all ---------------------------------------------------- flatbuffers-python/2.0-GCCcore-11.2.0 Python/2.7.18-GCCcore-11.2.0-bare Python/3.9.6-GCCcore-11.2.0 netcdf4-python/1.5.7-foss-2021b Python/2.7.18-GCCcore-11.3.0-bare Python/3.10.4-GCCcore-11.3.0-bare pkgconfig/1.5.5-GCCcore-11.2.0-python Python/3.9.5-GCCcore-10.3.0-bare Python/3.10.4-GCCcore-11.3.0 protobuf-python/3.17.3-GCCcore-10.3.0 Python/3.9.5-GCCcore-10.3.0 Python/3.10.8-GCCcore-12.2.0-bare protobuf-python/3.17.3-GCCcore-11.2.0 Python/3.9.6-GCCcore-11.2.0-bare Python/3.10.8-GCCcore-12.2.0
Loading and Unloading Modules
If a modulefile is not already loaded, use the module load command to load:
[mimi ~]$ module load netCDF/4.9.0-gompi-2022b
If you want to remove a software/library from your user environment you may unload it:
mimi ~]$ module unload netcdf/4.2.0_intel
You need to unload the same version you previously loaded.
Module Swapping
Alternatively, you can use the module swap command to unload one module and load the comparable module:
[mimi ~]$ module load netCDF/4.9.0-gompi-2022b
[mimi ~]$ module list Currently Loaded Modules: 1) GCCcore/12.2.0 8) libpciaccess/0.17-GCCcore-12.2.0 15) UCC/1.1.0-GCCcore-12.2.0 22) lz4/1.9.4-GCCcore-12.2.0 2) zlib/1.2.12-GCCcore-12.2.0 9) hwloc/2.8.0-GCCcore-12.2.0 16) OpenMPI/4.1.4-GCC-12.2.0 23) zstd/1.5.2-GCCcore-12.2.0 3) binutils/2.39-GCCcore-12.2.0 10) OpenSSL/1.1 17) gompi/2022b 24) bzip2/1.0.8-GCCcore-12.2.0 4) GCC/12.2.0 11) libevent/2.1.12-GCCcore-12.2.0 18) Szip/2.1.1-GCCcore-12.2.0 25) netCDF/4.9.0-gompi-2022b 5) numactl/2.0.16-GCCcore-12.2.0 12) UCX/1.13.1-GCCcore-12.2.0 19) HDF5/1.14.0-gompi-2022b 6) XZ/5.2.7-GCCcore-12.2.0 13) libfabric/1.16.1-GCCcore-12.2.0 20) cURL/7.86.0-GCCcore-12.2.0 7) libxml2/2.10.3-GCCcore-12.2.0 14) PMIx/4.2.2-GCCcore-12.2.0 21) gzip/1.12-GCCcore-12.2.0
[mimi ~]$ module swap netCDF/4.8.1-gompi-2021b The following have been reloaded with a version change: 1) GCC/12.2.0 => GCC/11.2.0 11) gompi/2022b => gompi/2021b 2) GCCcore/12.2.0 => GCCcore/11.2.0 12) hwloc/2.8.0-GCCcore-12.2.0 => hwloc/2.5.0-GCCcore-11.2.0 3) HDF5/1.14.0-gompi-2022b => HDF5/1.12.1-gompi-2021b 13) libevent/2.1.12-GCCcore-12.2.0 => libevent/2.1.12-GCCcore-11.2.0 4) OpenMPI/4.1.4-GCC-12.2.0 => OpenMPI/4.1.1-GCC-11.2.0 14) libfabric/1.16.1-GCCcore-12.2.0 => libfabric/1.13.2-GCCcore-11.2.0 5) PMIx/4.2.2-GCCcore-12.2.0 => PMIx/4.1.0-GCCcore-11.2.0 15) libpciaccess/0.17-GCCcore-12.2.0 => libpciaccess/0.16-GCCcore-11.2.0 6) Szip/2.1.1-GCCcore-12.2.0 => Szip/2.1.1-GCCcore-11.2.0 16) libxml2/2.10.3-GCCcore-12.2.0 => libxml2/2.9.10-GCCcore-11.2.0 7) UCX/1.13.1-GCCcore-12.2.0 => UCX/1.11.2-GCCcore-11.2.0 17) netCDF/4.9.0-gompi-2022b => netCDF/4.8.1-gompi-2021b 8) XZ/5.2.7-GCCcore-12.2.0 => XZ/5.2.5-GCCcore-11.2.0 18) numactl/2.0.16-GCCcore-12.2.0 => numactl/2.0.14-GCCcore-11.2.0 9) binutils/2.39-GCCcore-12.2.0 => binutils/2.37-GCCcore-11.2.0 19) zlib/1.2.12-GCCcore-12.2.0 => zlib/1.2.11-GCCcore-11.2.0 10) cURL/7.86.0-GCCcore-12.2.0 => cURL/7.78.0-GCCcore-11.2.0
Loading modules automatically
By default, one module is loaded at login (geosciences). However, you may want to customize your environment and load modules that you use often at login. It is recommended that you do this by creating a ~/.modulerc file. This file must contain the special modulefile token "#%Module1.0" on the first line followed by one or more module commands:
#%Module1.0 set version 1.0 module load netCDF/4.9.0-gompi-2022b
This will cause this version of netCDF to be automatically loaded when you log in.
Adding your our modulefile
Create a directory called privatemodules in your home directory. Then type the command:
module load use.own
and any personal module files in this directory will become available for you to list, load or unload. As previously explained, you can add it to ~/.modulerc to load it automatically at login.
Our modulefiles are in /opt/software/custom/modules and they can be copied to use as templates.
drift[at]geo.uio.no