Skip to main content

Usage of module Environment

The supercomputing platform uses the Environment Modules tool to manage the environment variables of application software.

Environment Modules is a tool to simplify shell initialization, allowing users to easily modify their environment during a session using modulefiles. Each module file contains the information needed to configure the shell for an application. Module files can be shared by many users on the system, and users can have their own collection to supplement or replace shared module files.

Basic module Commands

module avail/ava                           // Display available modules
module list // Display loaded modules
module load/add compilers/gcc-13.1.0 // Load module AAA
module unload/rm compilers/gcc-13.1.0 // Unload module
module purge // Unload all loaded tools
module show gcc/13.1.0 // View corresponding configuration information

Example of module Usage:

View modules that can be loaded with module

$ module avail 
---------------/usr/local/Modules/modulefiles ------------------------------------------------------------------------------------------------------
compilers/gcc-13.1.0 dot lammps/2022-serial mpi/mpich-4.1.2 mpi/mvapich2-2.3.7-1 null
compilers/icc-2023.1.0 gromacs/2023.2 module-git mpi/mpich-4.1.2_icc-2023.1.0 mpi/mvapich2-2.3.7-1_icc-2023.1.0 R/4.3.1
compilers/icc32-2023.1.0 intelmpi-2021.9.0 module-info mpi/mvapich-3.0b mpi/openmpi-4.1.5 use.own
compilers/mkl-2023.1.0 lammps/2022-parallel modules mpi/mvapich-3.0b_icc-2023.1.0 mpi/openmpi-4.1.5_icc-2023.1.0 vasp/6.3.2

Load gcc13.1

$ module load compilers/gcc-13.1.0 
$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/opt/compilers/gcc/131/libexec/gcc/x86_64-pc-linux-gnu/13.1.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ./configure --prefix=/opt/compilers/gcc/131 --enable-threads=posix -enable-checking=release -enable-languages=c,c++ -disable-multilib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 13.1.0 (GCC)

View loaded modules

$ module list
Currently Loaded Modulefiles:
1) compilers/gcc-13.1.0

Unload gcc13.1 module

$ module unload compilers/gcc-13.1.0 

View the module configuration of gcc 13.1

$ module show compilers/gcc-13.1.0 
------------------------------------------------------------------
/usr/local/Modules/modulefiles/compilers/gcc-13.1.0
prepend-path PATH /opt/compilers/gcc/131/bin
prepend-path LD_LIBRARY_PATH /opt/compilers/gcc/131/lib:/opt/compilers/gcc/131/lib64
------------------------------------------------------------------