2. Module Environment

2.1. Introdução

O sistema de módulos é uma ferramenta essencial para simplificar a gestão de ambientes de programação complexos. Ele permite o chaveamento dinâmico entre diferentes versões de softwares e bibliotecas, facilitando a configuração de ambientes específicos para cada projeto. Por exemplo, é possível alternar entre versões de compiladores, bibliotecas de matemática e implementações de MPI (OpenMPI ou MPICH), garantindo a compatibilidade e o isolamento de dependências entre diferentes aplicações.

2.2. Utilização do Module

Comandos básicos do module.

Comando

Descrição

module list

lista os módulos carregados

module avail

lista os módulos disponiveis

module help [modulefile]

mostra a sintaxe do comando module

module load modulefile [modulefile …]

carrega o(s) módulo(s) correspondente(s)

module unload modulefile [modulefile …]

descarrega o(s) módulo(s) correspondente(s)

2.3. Exemplos de Uso do Module

Segue abaixo alguns exemplos de como utilizar o comando module. Nenhum módulo é carregado por padrão.

[user1@sismom-1 ~]# module list
No modules loaded

O comando abaixo lista os módulos disponiveis. É importante observar que, em geral, ao carregar um módulo as demais dependências são carregadas automaticamente.

[user1@sismom-1 ~]# module avail
--------------------------------------------------- /opt/nvidia/hpc_sdk/modulefiles ----------------------------------------------------
nvhpc-byo-compiler/25.11    nvhpc-hpcx-cuda13/25.11    nvhpc-hpcx/25.11    nvhpc-nompi/25.11    nvhpc/25.11

----------------------------------------------------- /sw/spack/modulefiles/Core -------------------------------------------------------
autoconf/2.72-wvm23vb                         gdbm/1.25-vmtc5a5               libxcrypt/4.4.38-x6boyyz        pmix/6.0.0-d4kx7ze
automake/1.16.5-5nls7po                       gettext/0.23.1-qbu5t3e          libxml2/2.13.5-awkn4l5          prrte/4.0.0-77siopd
berkeley-db/18.1.40-uglzwsl                   glibc/2.39-4bfivdk              m4/1.4.20-m2sawyb               readline/8.3-2syk2t3
bison/3.8.2-7ymux64                           gmake/4.4.1-btsvjc4             mvapich/4.1-3iyprkj             tar/1.35-h6qtwye
bzip2/1.0.8-auu2zr7                           hwloc/2.12.2-6kx4tqr            ncurses/6.5-20250705-oodoawu    ucx/1.19.0-6syclxu
ca-certificates-mozilla/2025-08-12-6zmgkhw    krb5/1.21.3-dok3kb5             numactl/2.0.18-rex37xu          util-macros/1.20.1-nhys6n5
compiler-wrapper/1.0-mpcx7ru                  libedit/3.1-20240808-ltde37c    openmpi/5.0.8-i46gxvo           xz/5.6.3-gwh6san
diffutils/3.12-ykgzo6g                        libevent/2.1.12-en4eqpu         openssh/9.9p1-yorltq5           zlib-ng/2.2.4-bdnupiw
findutils/4.10.0-eq6rl62                      libiconv/1.18-e73p54c           openssl/3.6.0-rjfz3jm           zstd/1.5.7-sg72ps2
flex/2.6.3-7tzezjs                            libpciaccess/0.17-qcyy2j3       perl/5.42.0-npczjge
gcc-runtime/13.3.0-u6ksoly                    libsigsegv/2.14-i66thd4         pigz/2.8-o3hnfhw
gcc/13.3.0-uwfdr2q                            libtool/2.4.7-plxpooe           pkgconf/2.5.1-6pdibwg

----------------------------------------------------------- /sw/modulefiles ------------------------------------------------------------
miniconda3/py313_25.9.1

-------------------------------------------------- /usr/share/lmod/lmod/modulefiles ----------------------------------------------------
Core/lmod    Core/settarg (D)

  Where:
   D:  Default Module

If the avail list is too long consider trying:

"module --default avail" or "ml -d av" to just list the default modules.
"module overview" or "ml ov" to display the number of modules for each name.

Use "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".

Onde:

  • /opt/nvidia/hpc_sdk/modulefiles: modulefiles do NVIDIA HPC SDK: pacote de compiladores, bibliotecas e ferramentas essenciais para desenvolvedores para a plataforma NVIDIA

  • /sw/spack/modulefiles/Core: modulefiles gerados pelo Spack

  • /sw/modulefiles: modulefiles dos softwares em geral

  • /usr/share/lmod/lmod/modulefiles: modulefiles oriundos do lmod

Importante

Os modules (incluindo as versões) utilizados para compilar devem ser os mesmos a serem incluidos no script de submissão do job.

2.3.1. Obtendo informações sobre os módulos

[user1@sismom-1 ~]# module help openmpi

---------- Module Specific Help for "openmpi/5.0.8-i46gxvo" ------------
Name   : openmpi
Version: 5.0.8
Target : zen4

An open source Message Passing Interface implementation. The Open MPI
Project is an open source Message Passing Interface implementation that
is developed and maintained by a consortium of academic, research, and
industry partners. Open MPI is therefore able to combine the expertise,
technologies, and resources from all across the High Performance
Computing community in order to build the best MPI library available.
Open MPI offers advantages for system and software vendors, application
developers and computer science researchers.
[user1@sismom-1 ~]# module whatis mvapich
mvapich/4.1-3iyprkj : Name : mvapich
mvapich/4.1-3iyprkj : Version : 4.1
mvapich/4.1-3iyprkj : Target : zen4
mvapich/4.1-3iyprkj : Short description : Mvapich is a High-Performance MPI Library for clusters with diverse networks (InfiniBand, Omni-Path, Ethernet/iWARP, and RoCE) and computing platforms (x86 (Intel and AMD), ARM and OpenPOWER)
mvapich/4.1-3iyprkj : Configure options : --enable-shared --enable-romio --disable-silent-rules --disable-new-dtags --enable-fortran=all --enable-threads=multiple --with-ch3-rank-bits=32 --enable-wrapper-rpath=yes --disable-alloca --enable-fast=all --disable-cuda --enable-registration-cache --with-device=ch4:ucx

2.3.2. Carregando um Módulo

Carregando, listando e descarregando um módulo.

[user1@sismom-1 ~]# module list
No modules loaded

[user1@sismom-1 ~]# module load numactl
[user1@sismom-1 ~]# module list

Currently Loaded Modules:
  1) glibc/2.39-4bfivdk   2) gcc-runtime/13.3.0-u6ksoly   3) numactl/2.0.18-rex37xu

[user1@sismom-1 ~]# module unload numactl
[user1@sismom-1 ~]# module list
No modules loaded

2.3.3. Dependências

Em geral, ao carregar um module todas as dependências são carregadas automaticamente.

[user1@sismom-1 ~]# module load openmpi
[user1@sismom-1:~]# module list

Currently Loaded Modules:
  1) glibc/2.39-4bfivdk             8) libiconv/1.18-e73p54c         15) bzip2/1.0.8-auu2zr7       22) numactl/2.0.18-rex37xu
  2) gcc-runtime/13.3.0-u6ksoly     9) libxml2/2.13.5-awkn4l5        16) tar/1.35-h6qtwye          23) pmix/6.0.0-d4kx7ze
  3) ucx/1.19.0-6syclxu            10) hwloc/2.12.2-6kx4tqr          17) gettext/0.23.1-qbu5t3e    24) prrte/4.0.0-77siopd
  4) ncurses/6.5-20250705-oodoawu  11) openssl/3.6.0-rjfz3jm         18) krb5/1.21.3-dok3kb5       25) openmpi/5.0.8-i46gxvo
  5) libpciaccess/0.17-qcyy2j3     12) libedit/3.1-20240808-ltde37c  19) libxcrypt/4.4.38-x6boyyz
  6) xz/5.6.3-gwh6san              13) pigz/2.8-o3hnfhw              20) openssh/9.9p1-yorltq5
  7) zlib-ng/2.2.4-bdnupiw         14) zstd/1.5.7-sg72ps2            21) libevent/2.1.12-en4eqpu

2.3.4. Removendo todos os módulos

Para remover todos os módulos carregados anteriormente basta digitar o comando abaixo.

[user1@sismom-1 ~]# module purge
[user1@sismom-1 ~]# module list
No modules loaded
[user1@sismom-1 ~]#