OK, I already figure it out by reading this page from spack web. I need to create a config file with spack config edit packages
and add something like
packages:
openmpi:
buildable: False
modules:
openmpi@3.1.3%gcc@8.2.0 arch=linux-x86_64-centos7: /opt/modules/mpi/gcc/8/openmpi/3.1.3
all:
compiler: [gcc@8.2.0]
providers:
mpi: [openmpi@3.1.3]
Actually, I need to load first /opt/modules/compiladores/gcc/8
to make the /opt/modules/mpi/gcc/8/openmpi/3.1.3
visible, so I need something like
packages:
openmpi:
buildable: False
modules:
openmpi@3.1.3%gcc@8.2.0 arch=linux-x86_64-centos7:
- /opt/modules/compiladores/gcc/8
- /opt/modules/mpi/gcc/8/openmpi/3.1.3
But this does not work since it needs multiple external modules and it is not possible to specify more than one (see here).
Also, spack doesn't use the external module, it creates an internal one by coping and parsing. It will ignore module dependencies or environment variables from the original external module that might be important. modules.yaml
needs also to be properly configured to set or prepend this environment variables.