Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .uberenv_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"spack_url": "https://github.com/spack/spack.git",
"spack_commit": "734c5db2121b01c373eed6538e452f18887e9e44",
"spack_configs_path": "scripts/spack/configs",
"spack_packages_commit": "a75a7f75182ffc7a51c6ca7f0fec4bf9b2705be8",
"spack_packages_commit": "5af277dadb760efd2cc2be5bc5a8cadc44a9a4de",
"spack_packages_path": ["scripts/spack/radiuss-spack-configs/spack_repo/llnl_radiuss/packages", "scripts/spack/packages"],
"spack_concretizer": "clingo",
"vcpkg_url": "https://github.com/microsoft/vcpkg",
Expand Down
21 changes: 8 additions & 13 deletions scripts/spack/configs/toss_4_x86_64_ib_cray/spack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ spack:

toolchains:
rocm_6_4_2:
- spec: fflags=-Mfreeform
- spec: '%[email protected]'
when: '%c'
- spec: '%[email protected]'
Expand All @@ -32,6 +33,7 @@ spack:
- spec: '%[email protected]_6_4_2'
when: '%mpi'
rocm_6_3_1:
- spec: fflags=-Mfreeform
- spec: '%[email protected]'
when: '%c'
- spec: '%[email protected]'
Expand All @@ -41,6 +43,7 @@ spack:
- spec: '%[email protected]_6_3_1'
when: '%mpi'
cce_20:
- spec: fflags=-ef
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the benefit of having these in the toolchain vs the compiler spec?

Copy link
Member Author

@adrienbernede adrienbernede Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rationale is not entirely clear to me, but I trust @bmhan12 with it:
#1726 (reply in thread)

Now, personally, I see those configs as layers, from generic to specialized:
The compiler spec should be as generic as possible.
If we need to tune a compiler, the toolchain allows us do keep the compilers generic.
If a flag is only needed by a package, not the full stack, then it should be set in the package.

In this case, if Mfreeform and ef are Axom specific, I would set them in Axom package.
On the other hand, the extra-rpath appeared needed by any package built with those compilers, so we can define them in the compiler without loosing generality.

- spec: '%[email protected]'
when: '%c'
- spec: '%[email protected]'
Expand All @@ -67,27 +70,23 @@ spack:
llvm-amdgpu:
externals:
- spec: [email protected]
prefix: /opt/rocm-6.3.1/llvm
prefix: /opt/rocm-6.3.1
extra_attributes:
compilers:
c: /opt/rocm-6.3.1/llvm/bin/amdclang
cxx: /opt/rocm-6.3.1/llvm/bin/amdclang++
fortran: /opt/rocm-6.3.1/llvm/bin/amdflang
flags:
fflags: -Mfreeform
environment: {}
extra_rpaths: []
extra_rpaths: [/opt/rocmc-6.3.1/lib, /opt/rocm-6.3.1/lib/llvm/lib]
- spec: [email protected]
prefix: /opt/rocm-6.4.2/llvm
prefix: /opt/rocm-6.4.2
extra_attributes:
compilers:
c: /opt/rocm-6.4.2/llvm/bin/amdclang
cxx: /opt/rocm-6.4.2/llvm/bin/amdclang++
fortran: /opt/rocm-6.4.2/llvm/bin/amdflang
flags:
fflags: -Mfreeform
environment: {}
extra_rpaths: []
extra_rpaths: [/opt/rocm-6.4.2/lib, /opt/rocm-6.4.2/lib/llvm/lib]

cce:
externals:
Expand All @@ -98,12 +97,8 @@ spack:
c: /usr/tce/packages/cce-tce/cce-20.0.0/bin/craycc
cxx: /usr/tce/packages/cce-tce/cce-20.0.0/bin/crayCC
fortran: /usr/tce/packages/cce-tce/cce-20.0.0/bin/crayftn
# Flag for lowercase Fortran module names
flags:
fflags: -ef
environment: {}
extra_rpaths: []

extra_rpaths: [/opt/cray/pe/cce/20.0.0/cce/x86_64/lib]

hip:
# version: [6.3.1, 6.4.2]
Expand Down
59 changes: 25 additions & 34 deletions scripts/spack/packages/axom/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import socket
from os.path import join as pjoin

from spack.package import *
from spack.util.executable import which_string
from spack_repo.builtin.build_systems.cached_cmake import (
CachedCMakePackage,
Expand Down Expand Up @@ -38,6 +37,9 @@
)


from spack.package import *


def get_spec_path(spec, package_name, path_replacements={}, use_bin=False):
"""Extracts the prefix path for the given spack package
path_replacements is a dictionary with string replacements for the path.
Expand Down Expand Up @@ -90,10 +92,6 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
version("0.3.0", tag="v0.3.0", commit="20068ccab4b4f70055918b4f17960ec3ed6dbce8")
version("0.2.9", tag="v0.2.9", commit="9e9a54ede3326817c05f35922738516e43b5ec3d")

depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build", when="+fortran")

# https://github.com/spack/spack/issues/31829
patch("examples-oneapi.patch", when="@0.6.1 +examples %oneapi")

Expand Down Expand Up @@ -162,13 +160,19 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
# Dependencies
# -----------------------------------------------------------------------
# Basics
depends_on("c", type="build")
depends_on("cxx", type="build")
depends_on("fortran", type="build", when="+fortran")

depends_on("[email protected]:", type="build")
depends_on("[email protected]:", type="build", when="@0.7.0:")
depends_on("[email protected]:", type="build", when="+rocm")

depends_on("blt", type="build")
depends_on("[email protected]:", type="build", when="@0.12:")
depends_on("[email protected]", type="build", when="@0.11:")
depends_on("[email protected]", type="build", when="@0.9:0.10")
depends_on("[email protected]:0.5.3", type="build", when="@0.6.1:0.8")
depends_on("[email protected]:", type="build", when="@0.9:")

depends_on("mpi", when="+mpi")

Expand All @@ -191,8 +195,10 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):

with when("+umpire"):
depends_on("umpire")
depends_on("[email protected]:", when="@0.10:")
depends_on("[email protected]:", when="@0.9:")
depends_on("[email protected]:", when="@0.12:")
depends_on("[email protected]", when="@0.11")
depends_on("[email protected]", when="@0.10")
depends_on("[email protected]", when="@0.9")
depends_on("[email protected]:2023.06", when="@0.7.0:0.8")
depends_on("[email protected]", when="@0.6.0")
depends_on("umpire@5:5.0.1", when="@:0.5.0")
Expand All @@ -201,8 +207,10 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):

with when("+raja"):
depends_on("raja")
depends_on("[email protected]:", when="@0.10:")
depends_on("[email protected]:", when="@0.9:")
depends_on("[email protected]:", when="@0.12:")
depends_on("[email protected]", when="@0.11")
depends_on("[email protected]", when="@0.10")
depends_on("[email protected]", when="@0.9")
depends_on("[email protected]:2023.06", when="@0.7.0:0.8")
depends_on("[email protected]", when="@0.6.0")
depends_on("raja@:0.13.0", when="@:0.5.0")
Expand Down Expand Up @@ -383,15 +391,14 @@ def initconfig_compiler_entries(self):
if spec.satisfies("%cce"):
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-O1 -g"))

# Remove unusable -Mfreeform flag injected by spack
entries = [entry.replace("-Mfreeform", "") for entry in entries]

# Disable intrusive warning:
# icpx: remark: note that use of '-g' without any optimization-level
# option will turn off most compiler optimizations similar to use of
# '-O0'; use '-Rno-debug-disables-optimization' to disable this remark
if spec.satisfies("%oneapi"):
entries.append(cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-g -Rno-debug-disables-optimization"))
entries.append(
cmake_cache_string("CMAKE_CXX_FLAGS_DEBUG", "-g -Rno-debug-disables-optimization")
)

return entries

Expand Down Expand Up @@ -430,25 +437,17 @@ def initconfig_hardware_entries(self):

hip_link_flags = ""

rocm_root = os.path.dirname(spec["llvm-amdgpu"].prefix)
entries.append(cmake_cache_path("ROCM_ROOT_DIR", rocm_root))

# Recommended MPI flags
if spec.satisfies("+mpi"):
hip_link_flags += "-lxpmem "
hip_link_flags += "-L/opt/cray/pe/mpich/{0}/gtl/lib ".format(spec["mpi"].version.up_to(3))
hip_link_flags += "-L/opt/cray/pe/mpich/{0}/gtl/lib ".format(
spec["mpi"].version.up_to(3)
)
hip_link_flags += "-Wl,-rpath,/opt/cray/pe/mpich/{0}/gtl/lib ".format(
spec["mpi"].version.up_to(3)
)
hip_link_flags += "-lmpi_gtl_hsa "

if spec.satisfies("^[email protected]:"):
hip_link_flags += "-L{0}/lib/llvm/lib -Wl,-rpath,{0}/lib/llvm/lib ".format(rocm_root)
else:
hip_link_flags += "-L{0}/llvm/lib -Wl,-rpath,{0}/llvm/lib ".format(rocm_root)
# Only amdclang requires this path; cray compiler fails if this is included
if spec.satisfies("%llvm-amdgpu"):
hip_link_flags += "-L{0}/lib -Wl,-rpath,{0}/lib ".format(rocm_root)
hip_link_flags += "-lpgmath -lompstub "

# Fixes for mpi for rocm until wrapper paths are fixed
Expand All @@ -457,12 +456,6 @@ def initconfig_hardware_entries(self):
hip_link_flags += "-Wl,--disable-new-dtags "
hip_link_flags += "-lflang -lflangrti "

# Additional library path for cray compiler
if self.spec.satisfies("%cce"):
hip_link_flags += "-L/opt/cray/pe/cce/{0}/cce/x86_64/lib -Wl,-rpath,/opt/cray/pe/cce/{0}/cce/x86_64/lib ".format(
self.spec.compiler.version
)

# Remove extra link library for crayftn
if spec.satisfies("+fortran") and self.is_fortran_compiler("crayftn"):
entries.append(
Expand Down Expand Up @@ -491,9 +484,7 @@ def initconfig_hardware_entries(self):
if spec.satisfies("+fortran") and self.is_fortran_compiler("xlf"):
# Grab lib directory for the current fortran compiler
libdir = pjoin(os.path.dirname(os.path.dirname(self.compiler.fc)), "lib")
description = (
"Adds a missing rpath for libraries " "associated with the fortran compiler"
)
description = "Adds a missing rpath for libraries associated with the fortran compiler"

linker_flags = "${BLT_EXE_LINKER_FLAGS} -Wl,-rpath," + libdir

Expand Down