Module command
IPSL mesocenter ( spirit,spiritx and hal) uses module
command for software initialization (Version 5.0.1)
Syntax:
module
command could be now abbreviated in just ml
module (avail [product] | load product[/version] | list | switch product/version1 product/version2 | display
product[/version] ...)
avail
: list all known product and versionshelp
: display software informationload
: initialize a product in his default version if no version is specifiedlist
: list already loaded product and versionswitch
: changing the version of already loaded productpurge
: unload productdisplay
: display help and show which environment variables are modifiedsave
: _ Save current module list to collection_restore
: Restore module list from collection or file
more information with module help
command
Product could be a compiler, a library or a software
Sample
user@spirit1:~$ module avail
------------------------ /usr/share/modules/modulefiles ------------------------
dot module-git module-info modules null use.own
--------------- /net/nfs/tools/meso-u20/modules-spack/Compilers ----------------
gcc/9.4.0 gcc/11.2.0 intel/2021.4.0 nvhpc/21.9
gcc/10.3.0 intel/19.0.8.324 nvhpc/20.11
--------------- /net/nfs/tools/meso-u20/modules-spack/Libraries ----------------
armadillo/10.5.0 netcdf-c/4.7.4-mpi
blis/0.8.1 netcdf-c/4.7.4-parallel-netcdf
blitz/1.0.2 netcdf-c/4.7.4-serial
eccodes/2.21.0 netcdf-fortran/4.5.3
eccodes/2.21.0-openmp netcdf-fortran/4.5.3-mpi
eccodes/2.21.0-pthreads netcdf-fortran/4.5.3-parallel-netcdf
eccodes/2.21.0-serial netcdf-fortran/4.5.3-serial
flexiblas/3.0.4 openblas/0.3.14
hdf5/1.8.22 openblas/0.3.14-openmp
hdf5/1.8.22-mpi openblas/0.3.14-pthreads
hdf5/1.8.22-serial openblas/0.3.14-serial
hdf5/1.10.7 openblas/0.3.17
hdf5/1.10.7-mpi openblas/0.3.17-openmp
hdf5/1.10.7-serial openblas/0.3.17-pthreads
intel-mkl/2020.4.304 openblas/0.3.17-serial
intel-mkl/2020.4.304-openmp openmpi/4.0.7
intel-mkl/2020.4.304-serial parallel-netcdf/1.12.2
intel-mkl/2020.4.304-tbb ucx/1.11.2
jasper/2.0.32 valgrind/3.17.0-mpi
netcdf-c/4.7.4
---------------- /net/nfs/tools/meso-u20/modules-spack/Products ----------------
cdo/1.9.10 ferret/7.6.0 idl/8.2 matlab/2021b parallel/20200822
cylc/6.11.4 git-lfs/2.11.0 julia/1.6.3 nco/4.9.3 R/4.0.5
cylc/7.9.5 git/2.31.1 matlab/2019b nco/5.0.1 singularity/3.9.5
cylc/8.0rc1 idl/6.4 matlab/2020b nvtop/1.2.2
----------------- /net/nfs/tools/meso-u20/modules-spack/Python -----------------
anaconda3-py/2020.11 pytorch-ignite/0.4.3 pytorch/1.10.1
anaconda3-py/2021.11 pytorch-ignite/0.4.8 tensorflow/2.2.0
catboost/0.24.4 pytorch-lightning/1.1.8-gpu tensorflow/2.4.1
catboost/1.0.4 pytorch-lightning/1.5.10 tensorflow/2.6.3
jax/0.3.1 pytorch/1.7.1 tensorflow/2.7.0
lightgbm/3.3.2-cpu pytorch/1.8.2-lts xgboost/1.5.2
Using module
user@spirit1:~$ module list
No Modulefiles Currently Loaded.
user@spirit1:~$ gfortran --version
GNU Fortran (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0
user@spirit1:~$ module load gcc/10.3.0
user@spirit1:~$ gfortran --version
GNU Fortran (Spack GCC) 10.3.0
user@spirit1:~$ type matlab
-bash: type: matlab: not found
user@spirit1:~$ module avail matlab
---------------- /net/nfs/tools/meso-u20/modules-spack/Products ----------------
matlab/2019b matlab/2020b matlab/2021b
user@spirit1:~$ module load matlab/2021b
user@spirit1:~$ type matlab
matlab is /net/nfs/tools/matlab/2021b/matlab
Compilers and libraries modules
how to load libraries module
- Default compiler is OS compiler (gcc 9.4.0)
- if no compiler is loaded before loading a library, default compiler will be used
user@spirit1:~$ module list
No Modulefiles Currently Loaded.
user@spirit1:~$ module load openmpi/4.0.7
Loading openmpi/4.0.7
Loading requirement: gcc/9.4.0
user@spirit1:~$ type mpifort
mpifort is /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/openmpi/4.0.7-gcc-9.4.0-v4soq3vs5n5rex3gszzs7ffvud66aceh/bin/mpifort
user@spirit1:~$ module list
Currently Loaded Modulefiles:
1) intel/19.0.8.324
user@spirit1:~$ module load netcdf-fortran/4.5.3
user@spirit1:~$ module load netcdf-fortran/4.5.3
user@spirit1:~$ type nf-config
nf-config est /net/nfs/tools/u20/22.3/PrgEnv/intel/linux-ubuntu20.04-zen2/netcdf-fortran/4.5.3-intel-19.0.8.324-friscs3w2oeb73gbl37h4ae7p43fp2gh/bin/nf-config
- you can switch a compiler module and all already loaded library module are automatically switched for the new compiler
user@spirit1:~$ module load gcc/10.3.0 eccodes/2.21.0 openmpi/4.0.7 netcdf-fortran/4.5.3 jasper/2.0.32
user@spirit1:~$ module list
Currently Loaded Modulefiles:
1) gcc/10.3.0 2) eccodes/2.21.0 3) openmpi/4.0.7 4) netcdf-fortran/4.5.3 5) jasper/2.0.32
user@spirit1:~$ module switch gcc/10.3.0 intel/2021.4.0
Switching from gcc/10.3.0 to intel/2021.4.0
Unloading dependent: jasper/2.0.32 netcdf-fortran/4.5.3 openmpi/4.0.7 eccodes/2.21.0
Reloading dependent: eccodes/2.21.0 openmpi/4.0.7 netcdf-fortran/4.5.3 jasper/2.0.32
- to see which compiler is supported by a module (some are not supported by all compiler)
module help module_name/version user@spirit1:~$ module help jasper ------------------------------------------------------------------- Module Specific Help for /net/nfs/tools/meso-u20/modules/Libraries/jasper/2.0.32: Library for manipulating JPEG-2000 images Available software environment(s): - gcc/9.4.0 - gcc/10.3.0 - gcc/11.2.0 - intel/19.0.8.324 - intel/2021.4.0 If you want to use this module with another software environment, please contact the support team. mailto: meso-support@ipsl.fr -------------------------------------------------------------------
Module collection
you have the possibilty to save a list of module as a collection and restore them
user@spirit1:~$ ml purge
user@spirit1:~$ ml list
No Modulefiles Currently Loaded.
user@spirit1:~$ ml load intel/2021.4.0 netcdf-fortran/4.5.3-mpi netcdf-c/4.7.4-mpi hdf5/1.10.7-mpi openmpi/4.0.7
user@spirit1:~$ ml list
Currently Loaded Modulefiles:
1) intel/2021.4.0 2) netcdf-fortran/4.5.3-mpi 3) netcdf-c/4.7.4-mpi 4) hdf5/1.10.7-mpi 5) openmpi/4.0.7
user@spirit1:~$ ml save my-intel-env
user@spirit1:~$ ml purge
user@spirit1:~$ ml list
No Modulefiles Currently Loaded.
user@spirit1:~$ ml restore my-intel-env
Loading intel/2021.4.0
Loading netcdf-fortran/4.5.3-mpi
Loading netcdf-c/4.7.4-mpi
Loading hdf5/1.10.7-mpi
Loading openmpi/4.0.7
finding include and libs needed to compile my soft
-
some tools have their own compile command that do this for you:
- openmpi ( mpicc mpifort mpif90 mpif77)
- hdf5 ( h5cc h5fc)
-
some tools have their own utility to find include and libraries
- netcdf-fortran ( nf-config --flibs | nf-config --fflags)
-
netcdf ( nc-config --libs | nc-config --cflags)
-
this could be used in script to compile
FFLAGS="$(nf-config --fflags)"
LDFLAGS="$(nf-config --flibs)"
- this could be use in Makefile also
INC_CDF=$(shell nf-config --fflags)
LIB_CDF=$(shell nf-config --flibs)
user@spirit1:~$ ml load netcdf-fortran
Loading netcdf-fortran/4.5.3-serial
Loading requirement: gcc/9.4.0
user@spirit1:~$ nf-config --flibs
-L/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/netcdf-fortran/4.5.3-gcc-9.4.0-qljspmfrwblkxd5x6vz6ksij4xfjohfo/lib -lnetcdff
user@spirit1:~$ nf-config --fflags
-I/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/netcdf-fortran/4.5.3-gcc-9.4.0-qljspmfrwblkxd5x6vz6ksij4xfjohfo/include -I/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/netcdf-fortran/4.5.3-gcc-9.4.0-qljspmfrwblkxd5x6vz6ksij4xfjohfo/include
-
all our libraries packages support pkg-config method
- pkg-config --libs library_name
-
pkg-config --cflags library_name
-
this could be used in script to compile
FFLAGS="$(pkg-config --cflags library_name)"
LDFLAGS="$(pkg-config --libs library_name )"
-
this could be use in Makefile also
MY_INC=$(shell pkg-config --cflags library_name)
MY_LIB=$(shell pkg-config --libs library_name)
user@spirit1:~$ module load jasper
user@spirit1:~$ pkg-config --libs jasper
-L/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/jasper/2.0.32-gcc-9.4.0-n4jakgxec5pawylyyrxtnr3t47qizcp3/lib -ljasper
user@spirit1:~$ pkg-config --cflags jasper
-I/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/jasper/2.0.32-gcc-9.4.0-n4jakgxec5pawylyyrxtnr3t47qizcp3/include/jasper -I/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/jasper/2.0.32-gcc-9.4.0-n4jakgxec5pawylyyrxtnr3t47qizcp3/include
-
all our libraries packages have an environment variable <Product_name_UpperCase>_ROOT
- include could be find in <Product_name_UpperCase>_ROOT/include
- libs could be find in <Product_name_UpperCase>_ROOT/lib
user@spirit1:~$ module load openblas/0.3.17
Loading openblas/0.3.17
Loading requirement: gcc/9.4.0
user@spirit1:~$ env |grep ROOT
OPENBLAS_ROOT=/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/openblas/0.3.17-gcc-9.4.0-ies6zv7vdu7wxgx5pqjaxxftzqxcm3o3
- All our packages prepend the library path in LD_LIBRARY_PATH environment variable
finding what is modified in my environment when I load a module
For this use the module display command
user@spirit1:~$ module load hdf5/1.8.22-mpi
Loading hdf5/1.8.22-mpi
Loading requirement: gcc/9.4.0
user@spirit1:~$ module display hdf5/1.8.22-mpi
-------------------------------------------------------------------
/net/nfs/tools/meso-u20/modules/Libraries/hdf5/1.8.22-mpi:
module-whatis {HDF5 is a data model, library, and file format for storing and managing data. It supports an unlimited variety of datatypes, and is designed for flexible and efficient I/O and for high volume and complex data. }
prereq gcc/9.4.0 gcc/10.3.0 gcc/11.2.0 intel/19.0.8.324 intel/2021.4.0 nvhpc/20.11 nvhpc/21.9
conflict hdf5
prepend-path LD_LIBRARY_PATH /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/hdf5/1.8.22-gcc-9.4.0-xaqnfhyk3sphx4jt6kycvqjhgxagtgev/lib
prepend-path PATH /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/hdf5/1.8.22-gcc-9.4.0-xaqnfhyk3sphx4jt6kycvqjhgxagtgev/bin
prepend-path PKG_CONFIG_PATH /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/hdf5/1.8.22-gcc-9.4.0-xaqnfhyk3sphx4jt6kycvqjhgxagtgev/lib/pkgconfig
prepend-path CMAKE_PREFIX_PATH /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/hdf5/1.8.22-gcc-9.4.0-xaqnfhyk3sphx4jt6kycvqjhgxagtgev/
setenv HDF5_ROOT /net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/hdf5/1.8.22-gcc-9.4.0-xaqnfhyk3sphx4jt6kycvqjhgxagtgev
Available software environment(s):
- gcc/9.4.0
- gcc/10.3.0
- gcc/11.2.0
- intel/19.0.8.324
- intel/2021.4.0
- nvhpc/20.11
- nvhpc/21.9
If you want to use this module with another software environment,
please contact the support team.
mailto: meso-support@ipsl.fr
-------------------------------------------------------------------
finding which option have been used to compile the librairies in the module
From the module display command you have the path to the source module files
All compilation FLAGS for the software are in comment in the source module files for each compiler
user@spirit1:~$ head /net/nfs/tools/meso-u20/modules/Libraries/hdf5/1.8.22-mpi
#%Module1.0
# generated : 2022/03/25-07:06:54
#
## Module file created by spack (https://github.com/spack/spack) on 2022-03-25 06:20:23.500576
##
## hdf5@1.8.22%gcc@9.4.0~cxx+fortran+hl~ipo~java+mpi+shared+szip~threadsafe+tools api=default build_type=RelWithDebInfo arch=linux-ubuntu20.04-zen2/xaqnfhy
##
## Configure options: -DALLOW_UNSUPPORTED:BOOL=ON -DHDF5_BUILD_EXAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=ON -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON -DHDF5_ENABLE_SZIP_ENCODING:BOOL=ON -DBUILD_SHARED_LIBS:BOOL=ON -DONLY_SHARED_LIBS:BOOL=OFF -DHDF5_ENABLE_PARALLEL:BOOL=ON -DHDF5_ENABLE_THREADSAFE:BOOL=OFF -DHDF5_BUILD_HL_LIB:BOOL=ON -DHDF5_BUILD_CPP_LIB:BOOL=OFF -DHDF5_BUILD_FORTRAN:BOOL=ON -DHDF5_BUILD_JAVA:BOOL=OFF -DHDF5_BUILD_TOOLS:BOOL=ON -DCMAKE_C_COMPILER:STRING=/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/openmpi/4.0.7-gcc-9.4.0-v4soq3vs5n5rex3gszzs7ffvud66aceh/bin/mpicc -DCMAKE_Fortran_COMPILER:STRING=/net/nfs/tools/u20/22.3/PrgEnv/gcc/linux-ubuntu20.04-zen2/openmpi/4.0.7-gcc-9.4.0-v4soq3vs5n5rex3gszzs7ffvud66aceh/bin/mpif90
##
## Module file created by spack (https://github.com/spack/spack) on 2022-03-25 06:20:23.478368