Skip to content

Set a compiler's MODULEPATH before its meta-module loads modules - #2145

Merged
climbfuji merged 4 commits into
JCSDA:developfrom
pera-noaa:fix-compiler-modulepath-order
Oct 8, 2026
Merged

climbfuji merged 4 commits into
JCSDA:developfrom
pera-noaa:fix-compiler-modulepath-order

Conversation

@pera-noaa

Copy link
Copy Markdown
Contributor

Description

spack stack setup-meta-modules writes a compiler's extra_attributes: environment: prepend_path: MODULEPATH into the @ENVVARS@ block of the compiler meta-module, which the templates emit after @MODULELOADS@. So when the compiler's module is found only in that directory, the meta-module's load() runs before the directory is on MODULEPATH and fails from a clean shell. This PR writes a compiler's MODULEPATH changes into @MODULEPATHS@, which comes before the loads, after the hierarchy paths. All other environment changes stay in @ENVVARS@.

It also adds /apps/contrib/spack-stack/modulefiles, where the EPIC-installed intel-oneapi-compilers/2025.3.1 module lives, to the oneAPI compiler entry on Orion and Hercules. Today only setup.sh adds it, at build time, so users of the installed envs cannot load stack-intel-oneapi-compilers/2025.3.1 without a module use first.

One behaviour change: the site's MODULEPATH entry now goes on before the compiler's own modules load, not after. Any directories those modules add to MODULEPATH therefore come ahead of it, where before the site's directory came first.

Dependencies

None.

Issues addressed

Working towards #2144 (items 1 and 2: the generator side; the already-installed modulefiles still need editing or regenerating).

Applications affected

None directly; affects the meta-modules every application loads.

Systems affected

Sites whose compiler entry prepends MODULEPATH: hera, noaa-aws, noaa-azure, wheat and jean, and now orion and hercules. Nothing changes for other sites.

Testing

  • CI:
    • GitHub actions CI tests pass
    • GitHub actions CI tests do not pass (provide explanation)
    • GitHub actions CI tests skipped (provide explanation if necessary)
  • New tests added:
    • test_setup_meta_modules now gives the gcc external an environment MODULEPATH prepend and checks that stack-gcc/11.5.0 has it before module load gcc/11.5.0.
  • Additional testing:
    • spack unit-test --extension=stack on Hercules (Rocky 9.1, Python 3.11.7). On develop (f8e3e72) with only the new test: fails at the new check (MODULEPATH at offset 1133, load at 751). With this PR: 59 passed.
    • Hercules, clean shell: the installed 2.1.1 ue-oneapi-2025.3.1 stack-intel-oneapi-compilers/2025.3.1 fails ("unknown: intel-oneapi-compilers/2025.3.1"). A copy with prepend_path("MODULEPATH", "/apps/contrib/spack-stack/modulefiles") before its load(), which this PR generates, loads, and ifx is on PATH.
    • Not tested: building an env with setup-meta-modules on Orion or Hercules.

Aside, not changed here: the earlier assert(cond, "msg") calls in test_setup_meta_modules.py are always true (pytest warns "assertion is always true"), so those checks cannot fail.

Checklist

  • This PR addresses one issue/problem/enhancement or has a very good reason for not doing so.
  • These changes have been tested on the affected systems and applications.
  • All dependency PRs/issues have been resolved and this PR can be merged.
  • All necessary updates to the documentation (spack-stack wiki) will be made when this PR is merged

🤖 Generated with Claude Code

setup-meta-modules wrote a compiler's environment prepend of MODULEPATH
after the module loads, so a compiler module found only in that directory
could not be loaded. Write it with the module hierarchy, before the loads.
Add the directory of the EPIC-installed oneAPI compiler module to the
Orion and Hercules oneAPI compiler entries.
Comment thread spack-ext/lib/jcsda-emc/spack-stack/stack/meta_modules.py Outdated
@climbfuji

Copy link
Copy Markdown
Collaborator

I'll update this from develop after #2143 merges and run the tests before merging.

@climbfuji

Copy link
Copy Markdown
Collaborator

@pera-noaa Apologies, after merging #2143 there are merge conflicts. Can you resolve those, please?

@pera-noaa

Copy link
Copy Markdown
Contributor Author

Merged develop; unit tests pass (59/59 on Hercules).

@climbfuji
climbfuji enabled auto-merge (squash) October 8, 2026 02:22
@climbfuji
climbfuji merged commit a141693 into JCSDA:develop Oct 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants