Skip to content

Commit ca13e9d

Browse files
committed
Axom v0.13.0 recipe changes
1 parent ecfc622 commit ca13e9d

File tree

1 file changed

+137
-34
lines changed

1 file changed

+137
-34
lines changed

repos/spack_repo/builtin/packages/axom/package.py

Lines changed: 137 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@
1818

1919
from spack.package import *
2020

21+
# Axom components we expose to Spack. Core is always built and is not listed here.
22+
_AXOM_COMPONENTS = (
23+
"bump",
24+
"inlet",
25+
"klee",
26+
"lumberjack",
27+
"mint",
28+
"mir",
29+
"multimat",
30+
"primal",
31+
"quest",
32+
"sidre",
33+
"sina",
34+
"slam",
35+
"slic",
36+
"spin",
37+
)
38+
2139

2240
def get_spec_path(spec, package_name, path_replacements={}, use_bin=False):
2341
"""Extracts the prefix path for the given spack package
@@ -53,6 +71,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
5371

5472
version("main", branch="main")
5573
version("develop", branch="develop")
74+
version("0.13.0", tag="v0.13.0", commit="d00f6c66ef390ad746ae840f1074d982513611ac")
5675
version("0.12.0", tag="v0.12.0", commit="297544010a3dfb98145a1a85f09f9c648c00a18c")
5776
version("0.11.0", tag="v0.11.0", commit="685960486aa55d3a74a821ee02f6d9d9a3e67ab1")
5877
version("0.10.1", tag="v0.10.1", commit="6626ee1c5668176fb64dd9a52dec3e8596b3ba6b")
@@ -101,10 +120,30 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
101120
variant(
102121
"profiling",
103122
default=False,
104-
when="@develop",
105-
description="Build with hooks for Adiak/Caliper performance analysis",
123+
when="@:0.12.0",
124+
description="Build with hooks for Adiak/Caliper performance analysis. "
125+
"Deprecated -- use the adiak and/or caliper variants directly.",
126+
)
127+
128+
# variant for Axom components
129+
variant(
130+
"components",
131+
description=(
132+
"Comma separated list of Axom components to enable. "
133+
"'all' enables all components; 'none' disables all components "
134+
"Missing dependencies will be added (e.g. we'll add `sidre` "
135+
"and `conduit` for `components=inlet`)"
136+
),
137+
values=any_combination_of("all", *_AXOM_COMPONENTS).with_default("all"),
106138
)
107139

140+
variant("int64", default=True, description="Use 64bit integers for IndexType")
141+
142+
# variants for package dependencies
143+
variant("adiak", default=False, description="Build with adiak")
144+
variant("caliper", default=False, description="Build with caliper")
145+
variant("conduit", default=True, description="Build with conduit")
146+
108147
variant("opencascade", default=False, description="Build with opencascade")
109148

110149
variant("mfem", default=False, description="Build with mfem")
@@ -140,9 +179,10 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
140179

141180
# Libraries
142181
# Forward variants to Conduit
143-
for _var in ["fortran", "hdf5", "mpi", "python"]:
144-
depends_on("conduit+{0}".format(_var), when="+{0}".format(_var))
145-
depends_on("conduit~{0}".format(_var), when="~{0}".format(_var))
182+
with when("+conduit"):
183+
for _var in ["fortran", "hdf5", "mpi", "python"]:
184+
depends_on("conduit+{0}".format(_var), when="+{0}".format(_var))
185+
depends_on("conduit~{0}".format(_var), when="~{0}".format(_var))
146186

147187
depends_on("conduit+python", when="+devtools")
148188
depends_on("conduit~python", when="~devtools")
@@ -156,6 +196,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
156196

157197
with when("+umpire"):
158198
depends_on("umpire")
199+
depends_on("umpire@2025.12:", when="@0.13:")
159200
depends_on("umpire@2025.09:", when="@0.12:")
160201
depends_on("umpire@2025.03", when="@0.11")
161202
depends_on("umpire@2024.07", when="@0.10")
@@ -168,6 +209,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
168209

169210
with when("+raja"):
170211
depends_on("raja")
212+
depends_on("raja@2025.12.1:", when="@0.13:")
171213
depends_on("raja@2025.09:", when="@0.12:")
172214
depends_on("raja@2025.03", when="@0.11")
173215
depends_on("raja@2024.07", when="@0.10")
@@ -178,34 +220,34 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
178220
depends_on("raja~openmp", when="~openmp")
179221
depends_on("raja+openmp", when="+openmp")
180222

223+
# we're planning to remove support for the profiling variant,
224+
# but still need to support it for now
225+
depends_on("adiak", when="+adiak")
226+
depends_on("caliper", when="+caliper")
181227
with when("+profiling"):
182228
depends_on("adiak")
183229
depends_on("caliper+adiak~papi")
184230

185-
depends_on("caliper+cuda", when="+cuda")
186-
depends_on("caliper~cuda", when="~cuda")
187-
188-
depends_on("caliper+rocm", when="+rocm")
189-
depends_on("caliper~rocm", when="~rocm")
231+
with when("^adiak"):
232+
for fwd in ("mpi", "shared"):
233+
depends_on(f"adiak+{fwd}", when=f"+{fwd}")
190234

191-
for dep in ["adiak", "caliper"]:
192-
depends_on(f"{dep}+mpi", when="+mpi")
193-
depends_on(f"{dep}~mpi", when="~mpi")
194-
depends_on(f"{dep}+shared", when="+shared")
195-
depends_on(f"{dep}~shared", when="~shared")
235+
with when("^caliper"):
236+
for fwd in ("cuda", "rocm", "mpi", "shared"):
237+
depends_on(f"caliper+{fwd}", when=f"+{fwd}")
196238

197239
for val in CudaPackage.cuda_arch_values:
198240
ext_cuda_dep = f"+cuda cuda_arch={val}"
199241
depends_on(f"raja {ext_cuda_dep}", when=f"+raja {ext_cuda_dep}")
200242
depends_on(f"umpire {ext_cuda_dep}", when=f"+umpire {ext_cuda_dep}")
201-
depends_on(f"caliper {ext_cuda_dep}", when=f"+profiling {ext_cuda_dep}")
243+
depends_on(f"caliper {ext_cuda_dep}", when=f"{ext_cuda_dep} ^caliper")
202244
depends_on(f"mfem {ext_cuda_dep}", when=f"+mfem {ext_cuda_dep}")
203245

204246
for val in ROCmPackage.amdgpu_targets:
205247
ext_rocm_dep = f"+rocm amdgpu_target={val}"
206248
depends_on(f"raja {ext_rocm_dep}", when=f"+raja {ext_rocm_dep}")
207249
depends_on(f"umpire {ext_rocm_dep}", when=f"+umpire {ext_rocm_dep}")
208-
depends_on(f"caliper {ext_rocm_dep}", when=f"+profiling {ext_rocm_dep}")
250+
depends_on(f"caliper {ext_rocm_dep}", when=f"{ext_rocm_dep} ^caliper")
209251
depends_on(f"mfem {ext_rocm_dep}", when=f"+mfem {ext_rocm_dep}")
210252

211253
depends_on("rocprim", when="+rocm")
@@ -234,6 +276,32 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
234276
# (ENABLE_CLANGFORMAT will be OFF if not the exact version)
235277
depends_on("llvm+clang@19", type="build")
236278

279+
# Component requirements
280+
# -----------------------------------------------------------------------
281+
# Hard inter-component dependencies taken from Axom's dependency graph.
282+
requires(f"components={','.join(_AXOM_COMPONENTS)}", when="components=all")
283+
for c in _AXOM_COMPONENTS:
284+
conflicts(f"components={c}", when="components=none")
285+
286+
requires("components=slic,spin,primal", when="components=bump")
287+
requires("components=sidre,slic,primal", when="components=inlet")
288+
requires("components=sidre,slic,inlet,primal", when="components=klee")
289+
requires("components=slic,slam", when="components=mint")
290+
requires("components=bump,slic,slam,primal", when="components=mir")
291+
requires("components=slic,slam", when="components=multimat")
292+
requires("components=slic", when="components=primal")
293+
requires("components=slic,slam,primal,mint,spin", when="components=quest")
294+
requires("components=slic", when="components=sidre")
295+
requires("components=slic", when="components=sina")
296+
requires("components=slic", when="components=slam")
297+
requires("components=slic,slam,primal", when="components=spin")
298+
299+
# Hard dependencies of Axom components on other packages
300+
requires("+conduit", when="components=bump")
301+
requires("+conduit", when="components=mir")
302+
requires("+conduit", when="components=sidre")
303+
requires("+conduit", when="components=sina")
304+
237305
# -----------------------------------------------------------------------
238306
# Conflicts
239307
# -----------------------------------------------------------------------
@@ -254,6 +322,10 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage):
254322
conflicts("~umpire", when="+cuda")
255323
conflicts("~umpire", when="+rocm")
256324

325+
# The 'profiling' variant is deprecated after v0.12, but spack doesn't
326+
# give a reasonable error/warning message if it is set
327+
conflicts("+profiling", when="@develop")
328+
257329
conflicts("^blt@:0.3.6", when="+rocm")
258330

259331
def flag_handler(self, name, flags):
@@ -520,35 +592,64 @@ def initconfig_package_entries(self):
520592
entries = []
521593
path_replacements = {}
522594

595+
all_components_enabled = all(
596+
spec.satisfies(f"components={comp}") for comp in _AXOM_COMPONENTS
597+
)
598+
599+
if all_components_enabled:
600+
print("All axom components enabled")
601+
else:
602+
print(
603+
f"The following Axom components are enabled: {spec.variants['components'].value}"
604+
)
605+
606+
entries.append("#------------------{0}".format("-" * 60))
607+
entries.append("# Axom components")
608+
entries.append("#------------------{0}\n".format("-" * 60))
609+
entries.append(cmake_cache_option("AXOM_ENABLE_ALL_COMPONENTS", False))
610+
611+
for comp in spec.variants["components"].value:
612+
if comp in _AXOM_COMPONENTS:
613+
entries.append(cmake_cache_option(f"AXOM_ENABLE_{comp.upper()}", True))
614+
523615
# TPL locations
524616
entries.append("#------------------{0}".format("-" * 60))
525617
entries.append("# TPLs")
526618
entries.append("#------------------{0}\n".format("-" * 60))
527619

528620
# Try to find the common prefix of the TPL directory.
529621
# If found, we will use this in the TPL paths
530-
path1 = os.path.realpath(spec["conduit"].prefix)
531-
path2 = os.path.realpath(self.prefix)
532-
self.find_path_replacement(path1, path2, path_replacements, "TPL_ROOT", entries)
533-
534-
conduit_dir = get_spec_path(spec, "conduit", path_replacements)
535-
entries.append(cmake_cache_path("CONDUIT_DIR", conduit_dir))
536-
537-
# optional tpls
538-
for dep in ("mfem", "hdf5", "lua", "raja", "umpire", "opencascade"):
539-
if spec.satisfies("+%s" % dep):
622+
variant_deps = [
623+
"conduit",
624+
"c2c",
625+
"mfem",
626+
"hdf5",
627+
"lua",
628+
"raja",
629+
"umpire",
630+
"opencascade",
631+
"adiak",
632+
"caliper",
633+
]
634+
635+
for dep in variant_deps:
636+
if dep in ["lua"]: # skip entries often outside the common prefix
637+
continue
638+
639+
if spec.satisfies(f"^{dep}"):
640+
path1 = os.path.realpath(spec[dep].prefix)
641+
path2 = os.path.realpath(os.path.dirname(self.prefix))
642+
self.find_path_replacement(path1, path2, path_replacements, "TPL_ROOT", entries)
643+
break
644+
645+
# optional tpls based on variants
646+
for dep in variant_deps:
647+
if spec.satisfies(f"^{dep}"):
540648
dep_dir = get_spec_path(spec, dep, path_replacements)
541649
entries.append(cmake_cache_path("%s_DIR" % dep.upper(), dep_dir))
542650
else:
543651
entries.append("# %s not built\n" % dep.upper())
544652

545-
if spec.satisfies("+profiling"):
546-
dep_dir = get_spec_path(spec, "adiak", path_replacements)
547-
entries.append(cmake_cache_path("ADIAK_DIR", dep_dir))
548-
549-
dep_dir = get_spec_path(spec, "caliper", path_replacements)
550-
entries.append(cmake_cache_path("CALIPER_DIR", dep_dir))
551-
552653
if spec.satisfies("+umpire") and spec.satisfies("^camp"):
553654
dep_dir = get_spec_path(spec, "camp", path_replacements)
554655
entries.append(cmake_cache_path("CAMP_DIR", dep_dir))
@@ -645,6 +746,8 @@ def cmake_args(self):
645746
options.append(self.define_from_variant("AXOM_ENABLE_EXAMPLES", "examples"))
646747
options.append(self.define_from_variant("AXOM_ENABLE_TOOLS", "tools"))
647748
options.append(self.define_from_variant("AXOM_ENABLE_TUTORIALS", "tutorials"))
749+
options.append(self.define_from_variant("AXOM_USE_64BIT_INDEXTYPE", "int64"))
750+
648751
if self.spec.satisfies("~raja") or self.spec.satisfies("+umpire"):
649752
options.append("-DAXOM_ENABLE_MIR:BOOL=OFF")
650753

0 commit comments

Comments
 (0)