# Modules
# Basic information
Modules on a cluster are a mechanism that allows easy management of different versions of software and libraries. They enable users to quickly and seamlessly switch between various tools and environments without the need to manually configure access paths and environment variables.
Clusters often offer multiple versions of the same software, such as Python 3.8 and Python 3.10, or different versions of compilers and libraries. Modules help manage this complex environment by allowing users to load exactly the versions of software needed to run a specific application or project.
# Basics of use
Display list of loaded modules
Use the following command to display a list of loaded modules.
module list
A sample result of this command is shown below.
[username@hostname ~]$ module list
Currently Loaded Modulefiles:
1) open64-4.2.5.2
# Display a list of available modules
Use the following command to display a list of all available modules for a given user.
module avail
A sample result of this command is shown below.
[username@hostname ~]$ module avail
----------- /usr/share/Modules/PSNC/Development/Languages -----------
open64-4.2.5.2
----------- /usr/share/Modules/PSNC/Development/Libraries -----------
openmpi-gcc-x86_64 openmpi-opencc-x86_64
# Displaying additional information about a module
To display additional information about a module, use the following command.
module help <name_modul>
Below is an example of a command invocation for a module 'open64-4.2.5.2'.
[username@hostname ~]$ module help open64-4.2.5.2
----------- Module Specific Help for 'open64-4.2.5.2' ---------------------------
Name: AMD x86 Open64 Compiler Suite
Version: 4.2.5.2
Platform: x86_64
Category: Development/Languages
URL http://developer.amd.com
Provides: opencc, openCC, openf90, openf95
Description:
The x86 Open64 compiler system is a high performance, production
quality code generation tool designed for high performance parallel
computing workloads. The x86 Open64 environment provides the developer
the essential choices when building and optimizing C, C++, and Fortran
applications targeting 32-bit and 64-bit Linux platforms.
The x86 Open64 compiler system offers a high level of advanced
optimizations, multi-threading, and processor support that includes
global optimization, vectorization, interprocedural analysis, feedback
directed optimizations, loop transformations, and code generation
which extracts the optimal performance from each x86 processor core.
man pages: no
Restrictions: none
-------------------------------------------------------------------------------
# Loading the module
The following command is used to load a new module.
module load <nazwa_modulu>
# Unloading the module
The module is unloaded using the following command.
module unload <name_modul>
# Checking which environmental variables are modified by a given module
The following command can be used to find out which environmental variables are modified by a given module.
module show <name_modul>
An example of the command result is shown below.
[username@hostname ~]$ module show open64-4.2.5.2
-------------------------------------------------------------------
/usr/share/Modules/PSNC/Development/Languages/open64-4.2.5.2:
module-whatis AMD x86 Open64 Compiler Suite, 4.2.5.2
setenv open64_root /opt/x86_open64-4.2.5.2
prepend-path PATH /opt/x86_open64-4.2.5.2/bin
prepend-path LD_LIBRARY_PATH /opt/x86_open64-4.2.5.2/lib
prepend-path INCLUDE /opt/x86_open64-4.2.5.2/include
-------------------------------------------------------------------
# Personalisation of settings
In an environment where modules are used, the user can decide which modules will be loaded after logging into the system. To do so, edit the file ~/.bashrc or ~/.bash_profile and add the appropriate lines. Below is an example, in which to the MODULEPATH variable was added a path to the directory, where user modules are located and the open64 compiler module is loaded in version 4.2.5.2.
[username@hostname ~]$ cat ~/.bash_profile
...
# Environment Modules
# Prepend directory to the MODULEPATH environment variable.
module use --append $HOME/.modules/my_modules
# Modules loaded at login time.
module load open64-4.2.5.2
...
# Additional information
For additional information on using the modules, refer to the system manual by issuing one of the following commands.
# Information on the use of modules
man module
# Information on writing your own modules
man modulefile