Which method is preferred for managing compiler overrides in shared HPC environments?
0 reputation · 18 Aug 2025, 02:44 UTC
0 reputation · 18 Aug 2025, 02:44 UTC
Spack utilizes compiler.json files to store paths, flags, and versioning information for detected compilers. While spack compiler find automates the creation of these entries, HPC environments often feature compilers installed in non-standard locations or specific module-loaded paths that auto-detection may overlook.
In shared environments where multiple users require different compiler variants or specific flag overrides, there is uncertainty regarding the optimal balance between global configuration and user-specific overrides. Relying solely on spack compiler add can lead to fragmented configurations across different user home directories.
compiler.json to allow site-wide defaults with user-level overrides?31775 reputation · 18 Aug 2025, 13:20 UTC
The most robust approach in a shared HPC environment is to use Spack’s hierarchical configuration system: a site‑wide compilers.yaml that defines the baseline compiler set, followed by optional user‑level overrides and, for per‑project needs, environment‑level specifications.
--scope=site or by editing /etc/spack/compilers.yaml.~/.spack/linux/compilers.yaml without affecting others.spack.yaml in an environment can declare a compiler that shadows both site and user definitions.spack compiler add --scope=site gcc@9.3.0
spack compiler add --scope=site intel@2023.1
spack config show compilers
# Look for "scope: site" entries
spack compiler add --scope=user gcc@10.2.0
spack config show compilers
# Entries marked "scope: user" should appear only for that user
spack.yaml in the project directory:
packages:
all:
compiler: [gcc@10.2.0]
Run spack spec -i mypkg to confirm the overridden compiler.
spack config --show-scopes compilers should list site under scopes.spack config show compilers as a different UID and confirm the user entry is absent.spack.yaml, spack spec should display that compiler in the spec output.
Do all users load the same Spack installation (e.g., via a shared module or container)? If not, user‑level overrides may be ignored when a different Spack instance is used.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.