From f2b7ecd26c2767744e6a8ae87fbc60ce86827e15 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 10 Nov 2025 09:48:05 -0700 Subject: [PATCH 1/9] Shorten spack-generated module paths by means of compiler and MPI name translations --- configs/common/modules_lmod.yaml | 35 ++++++++++--- configs/common/modules_tcl.yaml | 25 +++++++++- .../spack-stack/stack/meta_modules.py | 49 ++++++++++++++----- 3 files changed, 88 insertions(+), 21 deletions(-) diff --git a/configs/common/modules_lmod.yaml b/configs/common/modules_lmod.yaml index 4b0d0370e..64cfb55b0 100644 --- a/configs/common/modules_lmod.yaml +++ b/configs/common/modules_lmod.yaml @@ -3,18 +3,41 @@ modules: default: roots: - lmod: $env/install/modulefiles + lmod: $env/modules lmod: # Core compiler is a dummy that is not used to build the stack, do not change. # Hopefully nobody is trying to build software with gcc-4.6 in 2023 ... core_compilers:: - gcc@4.6 projections: - ecmwf-atlas: 'atlas/{version}' - nlohmann-json: 'json/{version}' - nlohmann-json-schema-validator: 'json-schema-validator/{version}' - libjpeg-turbo: 'libjpeg/{version}' - prod-util: 'prod_util/{version}' + # Note: These translations of compiler and MPI library names must match the ALIASES + # dictionary in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py + # Defaults + '%intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' + ^mpi: '{^mpi.name}/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' + all: '{compiler.name}/{compiler.version}/{name}/{version}' + # The special cases - Intel classic compilers + 'ecmwf-atlas %intel-oneapi-compilers-classic': 'intel/{compiler.version}/atlas/{version}' + 'nlohmann-json %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo %intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' + 'prod-util %intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' + # The special cases - Intel LLVM compilers + 'ecmwf-atlas %intel-oneapi-compilers': 'oneapi/{compiler.version}/atlas/{version}' + 'nlohmann-json %intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator %intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo %intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' + 'prod-util %intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' + # The special cases - other compilers + ecmwf-atlas: '{compiler.name}/{compiler.version}/atlas/{version}' + nlohmann-json: '{compiler.name}/{compiler.version}/json/{version}' + nlohmann-json-schema-validator: '{compiler.name}/{compiler.version}/json-schema-validator/{version}' + libjpeg-turbo: '{compiler.name}/{compiler.version}/libjpeg/{version}' + prod-util: '{compiler.name}/{compiler.version}/prod_util/{version}' + exclude: # List of packages for which we don't need modules - apple-libunwind diff --git a/configs/common/modules_tcl.yaml b/configs/common/modules_tcl.yaml index 630c134c1..a48201992 100644 --- a/configs/common/modules_tcl.yaml +++ b/configs/common/modules_tcl.yaml @@ -3,16 +3,37 @@ modules: default: roots: - tcl: $env/install/modulefiles + tcl: $env/modules tcl: projections: - all: '{compiler.name}/{compiler.version}/{name}/{version}' + # Note: These translations of compiler and MPI library names must match the ALIASES + # dictionary in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py + # Defaults + '%intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '%intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' ^mpi: '{^mpi.name}/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' + all: '{compiler.name}/{compiler.version}/{name}/{version}' + # The special cases - Intel classic compilers + 'ecmwf-atlas %intel-oneapi-compilers-classic': 'intel/{compiler.version}/atlas/{version}' + 'nlohmann-json %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo %intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' + 'prod-util %intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' + # The special cases - Intel LLVM compilers + 'ecmwf-atlas %intel-oneapi-compilers': 'oneapi/{compiler.version}/atlas/{version}' + 'nlohmann-json %intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator %intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo %intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' + 'prod-util %intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' + # The special cases - other compilers ecmwf-atlas: '{compiler.name}/{compiler.version}/atlas/{version}' nlohmann-json: '{compiler.name}/{compiler.version}/json/{version}' nlohmann-json-schema-validator: '{compiler.name}/{compiler.version}/json-schema-validator/{version}' libjpeg-turbo: '{compiler.name}/{compiler.version}/libjpeg/{version}' prod-util: '{compiler.name}/{compiler.version}/prod_util/{version}' + exclude: # List of packages for which we don't need modules - apple-libunwind diff --git a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py index 8a6192748..387176c4c 100755 --- a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py +++ b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py @@ -52,13 +52,22 @@ "MPIROOT": "", } - -# DH* TODO: IMPORT THIS FROM SPACK, THEY MAINTAIN THE SAME DICTIONARY -COMPILER_TRANSLATION_TABLE = { +# Aliases to shorten module paths. These aliases must match the compiler +# and MPI name translations in configs/common/modules_{tcl,lmod}.yaml +ALIASES = { + "none" : "none", + # Compilers "gcc" : "gcc", - "clang" : "llvm", - "intel" : "intel-oneapi-compilers-classic", - "oneapi" : "intel-oneapi-compilers", + "intel-oneapi-compilers-classic" : "intel", + "intel-oneapi-compilers" : "oneapi", + "llvm" : "llvm", + # MPI + "cray-mpich" : "cray-mpich", + # Do we still need intel-mpi, and if yes, use the same impi? + "intel-oneapi-mpi" : "impi", + "mpich" : "mpich", + "mpt" : "mpt", + "openmpi" : "openmpi", } @@ -237,8 +246,10 @@ def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi for compiler in compiler_list: # First, compiler-dependent modules (compiler_name, compiler_version) = compiler.split("@") + # Module paths are short names + compiler_alias = ALIASES[compiler_name] cmd = "sed -i {4} 's#{0} {1}/{2}/#{0} #g' {3}".format( - pattern, compiler_name, compiler_version, filepath, sed_syntax_fix + pattern, compiler_alias, compiler_version, filepath, sed_syntax_fix ) status = os.system(cmd) if not status == 0: @@ -246,11 +257,13 @@ def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi # If mpi_provider is not None, also do compiler+mpi-dependent modules if not mpi_provider: continue + # Module paths are short names + mpi_alias = ALIASES[mpi_provider.name] cmd = "sed -i {6} 's#{0} {1}/{2}/{3}/{4}/#{0} #g' {5}".format( pattern, - mpi_provider.name, + mpi_alias, mpi_provider.version, - compiler_name, + compiler_alias, compiler_version, filepath, sed_syntax_fix, @@ -387,7 +400,10 @@ def custom_sort_key(entry): for compiler in compilers: logging.info(f" ... configuring compiler {compiler.name}@{compiler.version}") - modulepath_save = os.path.join(module_dir, compiler.name, str(compiler.version)) + # Short names for modulepaths + compiler_alias = ALIASES[compiler.name] + + modulepath_save = os.path.join(module_dir, compiler_alias, str(compiler.version)) if not os.path.isdir(modulepath_save): os.makedirs(modulepath_save) logging.info(" ... ... appending {} to MODULEPATHS_SAVE".format(modulepath_save)) @@ -496,7 +512,11 @@ def custom_sort_key(entry): # For tcl, append modulepath for external specs and for specs without # compiler dependencies; remove the compiler/mpi prefices from the moduless if module_choice == "tcl": - modulepath_save = os.path.join(module_dir, mpi_provider.name, str(mpi_provider.version), "none", "none") + + # Short names for modulepaths + mpi_alias = ALIASES[mpi_provider.name] + + modulepath_save = os.path.join(module_dir, mpi_alias, str(mpi_provider.version), "none", "none") if not os.path.isdir(modulepath_save): os.makedirs(modulepath_save) logging.info(" ... appending {} to MODULEPATHS_SAVE".format(modulepath_save)) @@ -514,9 +534,12 @@ def custom_sort_key(entry): ) ) + # Short names for modulepaths + compiler_alias = ALIASES[compiler.name] + # Spack mpi+compiler module hierarchy modulepath_save = os.path.join( - module_dir, mpi_provider.name, str(mpi_provider.version), compiler.name, str(compiler.version) + module_dir, mpi_alias, str(mpi_provider.version), compiler_alias, str(compiler.version) ) if not os.path.isdir(modulepath_save): os.makedirs(modulepath_save) @@ -537,7 +560,7 @@ def custom_sort_key(entry): # Path and name for mpi module file mpi_module_dir = os.path.join( - module_dir, compiler.name, str(compiler.version), "stack-" + mpi_provider.name + module_dir, compiler_alias, str(compiler.version), "stack-" + mpi_provider.name ) mpi_module_file = os.path.join( mpi_module_dir, str(mpi_provider.version).split("-")[0] + MODULE_FILE_EXTENSION[module_choice] From ddb64ff48ca5a0878b10d5fbbbb4e1426aff62c7 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 10 Nov 2025 09:48:28 -0700 Subject: [PATCH 2/9] [skip ci] Add missing MPI translations in configs/common/modules_{tcl,lmod}.yaml --- configs/common/modules_lmod.yaml | 30 +++++++++++++++--------------- configs/common/modules_tcl.yaml | 31 +++++++++++++++---------------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/configs/common/modules_lmod.yaml b/configs/common/modules_lmod.yaml index 64cfb55b0..dd6cb4925 100644 --- a/configs/common/modules_lmod.yaml +++ b/configs/common/modules_lmod.yaml @@ -13,26 +13,26 @@ modules: # Note: These translations of compiler and MPI library names must match the ALIASES # dictionary in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py # Defaults - '%intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic^intel-oneapi-mpi': 'impi/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers^intel-oneapi-mpi': 'impi/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' + ^intel-oneapi-mpi: 'impi/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' ^mpi: '{^mpi.name}/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' all: '{compiler.name}/{compiler.version}/{name}/{version}' # The special cases - Intel classic compilers - 'ecmwf-atlas %intel-oneapi-compilers-classic': 'intel/{compiler.version}/atlas/{version}' - 'nlohmann-json %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo %intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' - 'prod-util %intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' + 'nlohmann-json ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' + 'prod-util ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' # The special cases - Intel LLVM compilers - 'ecmwf-atlas %intel-oneapi-compilers': 'oneapi/{compiler.version}/atlas/{version}' - 'nlohmann-json %intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator %intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo %intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' - 'prod-util %intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' + 'nlohmann-json ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo ^intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' + 'prod-util ^intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' # The special cases - other compilers - ecmwf-atlas: '{compiler.name}/{compiler.version}/atlas/{version}' nlohmann-json: '{compiler.name}/{compiler.version}/json/{version}' nlohmann-json-schema-validator: '{compiler.name}/{compiler.version}/json-schema-validator/{version}' libjpeg-turbo: '{compiler.name}/{compiler.version}/libjpeg/{version}' diff --git a/configs/common/modules_tcl.yaml b/configs/common/modules_tcl.yaml index a48201992..cab7b3190 100644 --- a/configs/common/modules_tcl.yaml +++ b/configs/common/modules_tcl.yaml @@ -9,31 +9,30 @@ modules: # Note: These translations of compiler and MPI library names must match the ALIASES # dictionary in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py # Defaults - '%intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' - '%intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic^intel-oneapi-mpi': 'impi/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers^intel-oneapi-mpi': 'impi/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' + '^intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' + ^intel-oneapi-mpi: 'impi/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' ^mpi: '{^mpi.name}/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' all: '{compiler.name}/{compiler.version}/{name}/{version}' # The special cases - Intel classic compilers - 'ecmwf-atlas %intel-oneapi-compilers-classic': 'intel/{compiler.version}/atlas/{version}' - 'nlohmann-json %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator %intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo %intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' - 'prod-util %intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' + 'nlohmann-json ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' + 'prod-util ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' # The special cases - Intel LLVM compilers - 'ecmwf-atlas %intel-oneapi-compilers': 'oneapi/{compiler.version}/atlas/{version}' - 'nlohmann-json %intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator %intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo %intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' - 'prod-util %intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' + 'nlohmann-json ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' + 'nlohmann-json-schema-validator ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' + 'libjpeg-turbo ^intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' + 'prod-util ^intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' # The special cases - other compilers - ecmwf-atlas: '{compiler.name}/{compiler.version}/atlas/{version}' nlohmann-json: '{compiler.name}/{compiler.version}/json/{version}' nlohmann-json-schema-validator: '{compiler.name}/{compiler.version}/json-schema-validator/{version}' libjpeg-turbo: '{compiler.name}/{compiler.version}/libjpeg/{version}' prod-util: '{compiler.name}/{compiler.version}/prod_util/{version}' - exclude: # List of packages for which we don't need modules - apple-libunwind From df66093cbf3aa233d0e95160bd2877be7dcbdbb9 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 10 Nov 2025 10:02:51 -0700 Subject: [PATCH 3/9] Update .github/workflows/ubuntu-ci-x86_64-*.yaml to reflect changes in module paths --- .github/workflows/ubuntu-ci-x86_64-gnu.yaml | 2 +- .github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml | 2 +- .github/workflows/ubuntu-ci-x86_64-oneapi.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ubuntu-ci-x86_64-gnu.yaml b/.github/workflows/ubuntu-ci-x86_64-gnu.yaml index f915f1444..6699d3a84 100644 --- a/.github/workflows/ubuntu-ci-x86_64-gnu.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-gnu.yaml @@ -236,7 +236,7 @@ jobs: export ENVDIR=$PWD/envs/${ENVNAME} ls -l ${ENVDIR}/install/modulefiles/Core - module use ${ENVDIR}/install/modulefiles/Core + module use ${ENVDIR}/modules/Core module load stack-gcc/11.4.0 module load stack-openmpi/5.0.8 module available diff --git a/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml b/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml index c27ecaebc..f82093d7f 100644 --- a/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml @@ -244,7 +244,7 @@ jobs: export ENVDIR=$PWD/envs/${ENVNAME} ls -l ${ENVDIR}/install/modulefiles/Core - module use ${ENVDIR}/install/modulefiles/Core + module use ${ENVDIR}/modules/Core module load stack-intel-oneapi-compilers/2024.2.0 module load stack-intel-oneapi-mpi/2021.13 module available diff --git a/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml b/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml index 979761998..a8b464f6f 100644 --- a/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml @@ -244,7 +244,7 @@ jobs: export ENVDIR=$PWD/envs/${ENVNAME} ls -l ${ENVDIR}/install/modulefiles/Core - module use ${ENVDIR}/install/modulefiles/Core + module use ${ENVDIR}/modules/Core module load stack-intel-oneapi-compilers/2024.2.0 module load stack-intel-oneapi-mpi/2021.13 module available From 8e4514fcdcdbdba1e0829b32ed6498bff6766d8a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 10 Nov 2025 14:02:33 -0700 Subject: [PATCH 4/9] Revert compiler/mpi aliases for LMOD modules. Update util/modules_config_check.py so that tests pass --- .github/workflows/ubuntu-ci-x86_64-gnu.yaml | 2 +- .../ubuntu-ci-x86_64-oneapi-ifx.yaml | 2 +- .../workflows/ubuntu-ci-x86_64-oneapi.yaml | 2 +- configs/common/modules_lmod.yaml | 32 +++-------------- .../spack-stack/stack/meta_modules.py | 34 +++++++++++++------ util/modules_config_check.py | 15 ++------ 6 files changed, 33 insertions(+), 54 deletions(-) diff --git a/.github/workflows/ubuntu-ci-x86_64-gnu.yaml b/.github/workflows/ubuntu-ci-x86_64-gnu.yaml index 6699d3a84..815369e0a 100644 --- a/.github/workflows/ubuntu-ci-x86_64-gnu.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-gnu.yaml @@ -234,7 +234,7 @@ jobs: export ENVNAME=ue-gcc-11.4.0 export ENVDIR=$PWD/envs/${ENVNAME} - ls -l ${ENVDIR}/install/modulefiles/Core + ls -l ${ENVDIR}/modules/Core module use ${ENVDIR}/modules/Core module load stack-gcc/11.4.0 diff --git a/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml b/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml index f82093d7f..a1ebeab0b 100644 --- a/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-oneapi-ifx.yaml @@ -242,7 +242,7 @@ jobs: export ENVNAME=ue-oneifx-2024.2.0 export ENVDIR=$PWD/envs/${ENVNAME} - ls -l ${ENVDIR}/install/modulefiles/Core + ls -l ${ENVDIR}/modules/Core module use ${ENVDIR}/modules/Core module load stack-intel-oneapi-compilers/2024.2.0 diff --git a/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml b/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml index a8b464f6f..c4cbd7094 100644 --- a/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml +++ b/.github/workflows/ubuntu-ci-x86_64-oneapi.yaml @@ -242,7 +242,7 @@ jobs: export ENVNAME=ue-oneapi-2024.2.0 export ENVDIR=$PWD/envs/${ENVNAME} - ls -l ${ENVDIR}/install/modulefiles/Core + ls -l ${ENVDIR}/modules/Core module use ${ENVDIR}/modules/Core module load stack-intel-oneapi-compilers/2024.2.0 diff --git a/configs/common/modules_lmod.yaml b/configs/common/modules_lmod.yaml index dd6cb4925..8bdad785c 100644 --- a/configs/common/modules_lmod.yaml +++ b/configs/common/modules_lmod.yaml @@ -10,34 +10,10 @@ modules: core_compilers:: - gcc@4.6 projections: - # Note: These translations of compiler and MPI library names must match the ALIASES - # dictionary in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py - # Defaults - '^intel-oneapi-compilers-classic^intel-oneapi-mpi': 'impi/{^mpi.version}/intel/{compiler.version}/{name}/{version}' - '^intel-oneapi-compilers-classic^mpi': '{^mpi.name}/{^mpi.version}/intel/{compiler.version}/{name}/{version}' - '^intel-oneapi-compilers-classic': 'intel/{compiler.version}/{name}/{version}' - '^intel-oneapi-compilers^intel-oneapi-mpi': 'impi/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' - '^intel-oneapi-compilers^mpi': '{^mpi.name}/{^mpi.version}/oneapi/{compiler.version}/{name}/{version}' - '^intel-oneapi-compilers': 'oneapi/{compiler.version}/{name}/{version}' - ^intel-oneapi-mpi: 'impi/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' - ^mpi: '{^mpi.name}/{^mpi.version}/{compiler.name}/{compiler.version}/{name}/{version}' - all: '{compiler.name}/{compiler.version}/{name}/{version}' - # The special cases - Intel classic compilers - 'nlohmann-json ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/libjpeg/{version}' - 'prod-util ^intel-oneapi-compilers-classic': 'intel/{compiler.version}/prod_util/{version}' - # The special cases - Intel LLVM compilers - 'nlohmann-json ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json/{version}' - 'nlohmann-json-schema-validator ^intel-oneapi-compilers': 'oneapi/{compiler.version}/json-schema-validator/{version}' - 'libjpeg-turbo ^intel-oneapi-compilers': 'oneapi/{compiler.version}/libjpeg/{version}' - 'prod-util ^intel-oneapi-compilers': 'oneapi/{compiler.version}/prod_util/{version}' - # The special cases - other compilers - nlohmann-json: '{compiler.name}/{compiler.version}/json/{version}' - nlohmann-json-schema-validator: '{compiler.name}/{compiler.version}/json-schema-validator/{version}' - libjpeg-turbo: '{compiler.name}/{compiler.version}/libjpeg/{version}' - prod-util: '{compiler.name}/{compiler.version}/prod_util/{version}' - + nlohmann-json: 'json/{version}' + nlohmann-json-schema-validator: 'json-schema-validator/{version}' + libjpeg-turbo: 'libjpeg/{version}' + prod-util: 'prod_util/{version}' exclude: # List of packages for which we don't need modules - apple-libunwind diff --git a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py index 387176c4c..d940d856e 100755 --- a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py +++ b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py @@ -52,8 +52,8 @@ "MPIROOT": "", } -# Aliases to shorten module paths. These aliases must match the compiler -# and MPI name translations in configs/common/modules_{tcl,lmod}.yaml +# Aliases to shorten module paths for tcl modules. These aliases must match +# the compiler and MPI name translations in configs/common/modules_tcl.yaml ALIASES = { "none" : "none", # Compilers @@ -246,8 +246,11 @@ def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi for compiler in compiler_list: # First, compiler-dependent modules (compiler_name, compiler_version) = compiler.split("@") - # Module paths are short names - compiler_alias = ALIASES[compiler_name] + # Module paths are short names for tcl modules + if module_choice == "lmod": + compiler_alias = compiler_name + else: + compiler_alias = ALIASES[compiler_name] cmd = "sed -i {4} 's#{0} {1}/{2}/#{0} #g' {3}".format( pattern, compiler_alias, compiler_version, filepath, sed_syntax_fix ) @@ -257,8 +260,11 @@ def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi # If mpi_provider is not None, also do compiler+mpi-dependent modules if not mpi_provider: continue - # Module paths are short names - mpi_alias = ALIASES[mpi_provider.name] + # Module paths are short names for tcl modules + if module_choice == "lmod": + mpi_alias = mpi_provider.name + else: + mpi_alias = ALIASES[mpi_provider.name] cmd = "sed -i {6} 's#{0} {1}/{2}/{3}/{4}/#{0} #g' {5}".format( pattern, mpi_alias, @@ -400,8 +406,11 @@ def custom_sort_key(entry): for compiler in compilers: logging.info(f" ... configuring compiler {compiler.name}@{compiler.version}") - # Short names for modulepaths - compiler_alias = ALIASES[compiler.name] + # Module paths are short names for tcl modules + if module_choice == "lmod": + compiler_alias = compiler.name + else: + compiler_alias = ALIASES[compiler.name] modulepath_save = os.path.join(module_dir, compiler_alias, str(compiler.version)) if not os.path.isdir(modulepath_save): @@ -513,7 +522,7 @@ def custom_sort_key(entry): # compiler dependencies; remove the compiler/mpi prefices from the moduless if module_choice == "tcl": - # Short names for modulepaths + # Module paths are short names for tcl modules mpi_alias = ALIASES[mpi_provider.name] modulepath_save = os.path.join(module_dir, mpi_alias, str(mpi_provider.version), "none", "none") @@ -534,8 +543,11 @@ def custom_sort_key(entry): ) ) - # Short names for modulepaths - compiler_alias = ALIASES[compiler.name] + # Module paths are short names for tcl modules + if module_choice == "lmod": + mpi_alias = compiler.name + else: + compiler_alias = ALIASES[compiler.name] # Spack mpi+compiler module hierarchy modulepath_save = os.path.join( diff --git a/util/modules_config_check.py b/util/modules_config_check.py index eb7a2fdf6..89c913902 100755 --- a/util/modules_config_check.py +++ b/util/modules_config_check.py @@ -20,21 +20,12 @@ yaml_raw = f.read().replace("lmod:", "LMOD_OR_TCL:").replace("tcl:", "LMOD_OR_TCL:") modules[lmod_or_tcl] = syaml.load_config(yaml_raw) -# Check subset of projection to ensure keys match -lmod_projections = modules["lmod"]["modules"]["default"]["LMOD_OR_TCL"]["projections"].keys() -tcl_projections = modules["tcl"]["modules"]["default"]["LMOD_OR_TCL"]["projections"].keys() -assert set(lmod_projections) == set(tcl_projections)-{"all", "^mpi"} - -for lmod_or_tcl in ("lmod", "tcl"): - for key in modules[lmod_or_tcl]["modules"]["default"]["LMOD_OR_TCL"]["projections"].keys(): - modules[lmod_or_tcl]["modules"]["default"]["LMOD_OR_TCL"]["projections"][key] = "DUMMYVALUE" - # Removing sections we don't want to compare; note this will -# affect line numbers in the diff output +# affect line numbers in the diff output del(modules["lmod"]["modules"]["default"]["LMOD_OR_TCL"]["core_compilers"]) del(modules["lmod"]["modules"]["default"]["LMOD_OR_TCL"]["hierarchy"]) -del(modules["tcl"]["modules"]["default"]["LMOD_OR_TCL"]["projections"]["all"]) -del(modules["tcl"]["modules"]["default"]["LMOD_OR_TCL"]["projections"]["^mpi"]) +del(modules["lmod"]["modules"]["default"]["LMOD_OR_TCL"]["projections"]) +del(modules["tcl"]["modules"]["default"]["LMOD_OR_TCL"]["projections"]) # If sections mismatch, print a diff of the whole configuration dump_lmod = syaml.dump_config(modules["lmod"]).split("\n") From c85550f4a334a4182dd618ac6e1a156c0ec30c52 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Mon, 10 Nov 2025 16:01:58 -0700 Subject: [PATCH 5/9] Fix bug in spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py and update spack-ext/lib/jcsda-emc/spack-stack/tests/test_setup_meta_modules.py --- .../jcsda-emc/spack-stack/stack/meta_modules.py | 14 +++++++++----- .../spack-stack/tests/test_setup_meta_modules.py | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py index d940d856e..2d99c9463 100755 --- a/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py +++ b/spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py @@ -229,7 +229,7 @@ def get_preferred_compiler(): return preferred_compiler -def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi_provider): +def remove_compiler_prefices_from_tcl_modulefiles(modulepath, compiler_list, mpi_provider, module_choice): """Remove compiler and mpi prefices from tcl modulefiles in modulepath""" logging.info(f" ... ... removing compiler/mpi prefices from tcl modulefiles in {modulepath}") module_replace_patterns = ["is-loaded", "module load", "depends-on"] @@ -400,7 +400,8 @@ def custom_sort_key(entry): remove_compiler_prefices_from_tcl_modulefiles( modulepath_save, compiler_list, - mpi_provider = None + mpi_provider = None, + module_choice = module_choice ) for compiler in compilers: @@ -423,7 +424,8 @@ def custom_sort_key(entry): remove_compiler_prefices_from_tcl_modulefiles( modulepath_save, compiler_list, - mpi_provider = None + mpi_provider = None, + module_choice = module_choice ) # The remainder of the loop is only needed for the preferred compiler @@ -533,7 +535,8 @@ def custom_sort_key(entry): remove_compiler_prefices_from_tcl_modulefiles( modulepath_save, compiler_list, - mpi_provider = mpi_provider + mpi_provider = mpi_provider, + module_choice = module_choice ) for compiler in compilers: @@ -563,7 +566,8 @@ def custom_sort_key(entry): remove_compiler_prefices_from_tcl_modulefiles( modulepath_save, compiler_list, - mpi_provider = mpi_provider + mpi_provider = mpi_provider, + module_choice = module_choice ) # The remainder of the loop is only needed for the preferred compiler diff --git a/spack-ext/lib/jcsda-emc/spack-stack/tests/test_setup_meta_modules.py b/spack-ext/lib/jcsda-emc/spack-stack/tests/test_setup_meta_modules.py index d72845017..f4abf6135 100644 --- a/spack-ext/lib/jcsda-emc/spack-stack/tests/test_setup_meta_modules.py +++ b/spack-ext/lib/jcsda-emc/spack-stack/tests/test_setup_meta_modules.py @@ -35,7 +35,7 @@ def test_setup_meta_modules(): env_name = "modtest1" env_dir = os.path.join(env_root_dir, env_name) - module_dir = os.path.join(env_dir, "install", "modulefiles") + module_dir = os.path.join(env_dir, "modules") if os.path.exists(env_dir): shutil.rmtree(env_dir) From 126b59527b32480b2d2688ab09b886441d2e978f Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 11 Nov 2025 07:54:56 -0700 Subject: [PATCH 6/9] Update submodule pointer for repos/builtin (netcdf-c mpi bug) --- repos/builtin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/builtin b/repos/builtin index b091bced9..c768aafd9 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit b091bced9a958042cf03f6cd4a2989dfabd10891 +Subproject commit c768aafd9e095b9fcf3eed039e25104984880d68 From 4312e4070f2b72532827b034b1df601ef97f7e88 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 11 Nov 2025 09:48:56 -0700 Subject: [PATCH 7/9] Update .gitmodules and submodule pointer for repos/builtin for code review and testing --- .gitmodules | 6 ++++-- repos/builtin | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 068339c16..faf7ac9ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,5 +10,7 @@ branch = v1.3.0 [submodule "repos/builtin"] path = repos/builtin - url = https://github.com/jcsda/spack-packages - branch = spack-stack-dev + #url = https://github.com/jcsda/spack-packages + #branch = spack-stack-dev + url = https://github.com/climbfuji/spack-packages + branch = bugfix/netcdf_c_cmake_mpi_spack_stack_dev diff --git a/repos/builtin b/repos/builtin index c768aafd9..539d57a6f 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit c768aafd9e095b9fcf3eed039e25104984880d68 +Subproject commit 539d57a6fb85c6159276f7f3a22ac85e49e0c988 From 0aead11adbd030ae9a9ea3cbac5dc833ec16d426 Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Tue, 11 Nov 2025 09:48:56 -0700 Subject: [PATCH 8/9] Update .gitmodules and submodule pointer for repos/builtin for code review and testing --- .gitmodules | 6 ++++-- repos/builtin | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 068339c16..faf7ac9ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,5 +10,7 @@ branch = v1.3.0 [submodule "repos/builtin"] path = repos/builtin - url = https://github.com/jcsda/spack-packages - branch = spack-stack-dev + #url = https://github.com/jcsda/spack-packages + #branch = spack-stack-dev + url = https://github.com/climbfuji/spack-packages + branch = bugfix/netcdf_c_cmake_mpi_spack_stack_dev diff --git a/repos/builtin b/repos/builtin index c768aafd9..e135cac2e 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit c768aafd9e095b9fcf3eed039e25104984880d68 +Subproject commit e135cac2e7b995cdc268c6f76a41529562425d26 From f47b07628d0c8559cebdfcdf83eb772e981275ff Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Wed, 12 Nov 2025 10:55:43 -0700 Subject: [PATCH 9/9] Revert .gitmodules and submodule pointer for repos/builtin --- .gitmodules | 6 ++---- repos/builtin | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.gitmodules b/.gitmodules index faf7ac9ad..068339c16 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,7 +10,5 @@ branch = v1.3.0 [submodule "repos/builtin"] path = repos/builtin - #url = https://github.com/jcsda/spack-packages - #branch = spack-stack-dev - url = https://github.com/climbfuji/spack-packages - branch = bugfix/netcdf_c_cmake_mpi_spack_stack_dev + url = https://github.com/jcsda/spack-packages + branch = spack-stack-dev diff --git a/repos/builtin b/repos/builtin index e135cac2e..bfc55569e 160000 --- a/repos/builtin +++ b/repos/builtin @@ -1 +1 @@ -Subproject commit e135cac2e7b995cdc268c6f76a41529562425d26 +Subproject commit bfc55569ef288de441a42131f58579e8b7fe64a0