From 91572e3ff597caa8de83a54379eade5e6101ca0c Mon Sep 17 00:00:00 2001 From: Brian Han Date: Wed, 29 Jul 2026 09:34:21 -0700 Subject: [PATCH 1/4] Axom - update recipe with C++20 and +python variant changes --- .../builtin/packages/axom/package.py | 176 ++++++++++++++---- 1 file changed, 144 insertions(+), 32 deletions(-) diff --git a/repos/spack_repo/builtin/packages/axom/package.py b/repos/spack_repo/builtin/packages/axom/package.py index 0f8262df5f9..18f0992b55b 100644 --- a/repos/spack_repo/builtin/packages/axom/package.py +++ b/repos/spack_repo/builtin/packages/axom/package.py @@ -5,6 +5,7 @@ import os import shutil import socket +import tempfile from os.path import join as pjoin from spack_repo.builtin.build_systems.cached_cmake import ( @@ -113,8 +114,11 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): variant("tools", default=True, description="Build tools") variant("tutorials", default=True, description="Build tutorials") - # Hard requirement after Axom 0.6.1 - variant("cpp14", default=True, description="Build with C++14 support") + variant( + "cpp14", + default=False, + description="Build with C++14 support. Deprecated -- use the cxxstd variant version.", + ) variant("fortran", default=True, description="Build with Fortran support") @@ -150,20 +154,24 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): variant("adiak", default=False, when="@0.13:", description="Build with adiak") variant("caliper", default=False, when="@0.13:", description="Build with caliper") variant("conduit", default=True, description="Build with conduit") - - variant("opencascade", default=False, description="Build with opencascade") - - variant("mfem", default=False, description="Build with mfem") variant("hdf5", default=True, description="Build with hdf5") variant("lua", default=True, description="Build with Lua") + variant("mfem", default=False, description="Build with mfem") + variant("opencascade", default=False, description="Build with opencascade") + variant("raja", default=True, description="Build with raja") variant("scr", default=False, description="Build with SCR") variant("umpire", default=True, description="Build with umpire") - variant("raja", default=True, description="Build with raja") - varmsg = "Build development tools (such as Sphinx, Doxygen, etc...)" variant("devtools", default=False, description=varmsg) + variant( + "cxxstd", + default="20", + values=("11", "14", "17", "20"), + description="C++ standard to build with", + ) + # ----------------------------------------------------------------------- # Dependencies # ----------------------------------------------------------------------- @@ -278,14 +286,20 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("mfem~mpi", when="~mpi") depends_on("mfem@4.5.0:", when="@0.7.0:") - depends_on("python", when="+python") - # Python with when("+python"): + depends_on("python") + + # extending python allows spack environment views to import axom from python + extends("python") + depends_on("py-nanobind@2.7.0:") depends_on("py-pytest") + depends_on("py-packaging") + depends_on("py-pygments") depends_on("py-numpy") - depends_on("conduit+python") + depends_on("py-mpi4py", when="+mpi") + depends_on("conduit+python", when="+conduit") # Devtools with when("+devtools"): @@ -302,6 +316,7 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # (ENABLE_CLANGFORMAT will be OFF if not the exact version) depends_on("llvm+clang@19", type="build") + # ----------------------------------------------------------------------- # Component requirements # ----------------------------------------------------------------------- # Hard inter-component dependencies taken from Axom's dependency graph. @@ -329,8 +344,13 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # ----------------------------------------------------------------------- # Conflicts # ----------------------------------------------------------------------- - # Hard requirement after Axom 0.6.1 - conflicts("~cpp14", when="@0.6.2:") + + # C++14 required as of 0.6.2 + conflicts("cxxstd=11", when="@0.6.2:") + # C++17 required as of 0.12.0 + conflicts("cxxstd=14", when="@0.12.0:") + # C++20 required as of unreleased 0.15.0 + conflicts("cxxstd=17", when="@0.15.0:") # Conduit's cmake config files moved and < 0.4.0 can't find it conflicts("^conduit@0.7.2:", when="@:0.4.0") @@ -388,6 +408,10 @@ def cache_name(self): special_case, ) + @property + def cxx_std(self): + return self.spec.variants.get("cxxstd").value + def initconfig_compiler_entries(self): spec = self.spec entries = super().initconfig_compiler_entries() @@ -409,7 +433,7 @@ def initconfig_compiler_entries(self): else: entries.append(cmake_cache_option("ENABLE_FORTRAN", False)) - if spec.satisfies("+cpp14") and spec.satisfies("@:0.6.1"): + if (spec.satisfies("+cpp14") or self.cxx_std == "14") and spec.satisfies("@:0.6.1"): entries.append(cmake_cache_string("BLT_CXX_STD", "c++14", "")) # Add optimization flag workaround for builds with cray compiler @@ -449,7 +473,7 @@ def initconfig_hardware_entries(self): if spec.satisfies("^blt@:0.5.1"): # This is handled internally by BLT now - if spec.satisfies("+cpp14"): + if spec.satisfies("+cpp14") or self.cxx_std == "14": cudaflags += " -std=c++14" else: cudaflags += " -std=c++11" @@ -499,25 +523,41 @@ def initconfig_hardware_entries(self): hip_link_flags += "-lflang -lflangrti " # Additional library path for cray compiler - if self.spec.satisfies("%cce"): - lib_path = "/opt/cray/pe/cce/{0}/cce/x86_64/lib".format(self.spec.compiler.version) + if spec.satisfies("%cce"): + lib_path = "/opt/cray/pe/cce/{0}/cce/x86_64/lib".format(spec.compiler.version) hip_link_flags += "-L{0} -Wl,-rpath,{0}".format(lib_path) if spec.satisfies("+fortran"): - link_remove_list = [] + link_lib_remove_list = [] + link_dir_remove_list = [] + + if self.cxx_std == "20": + link_dir_remove_list += [ + "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12" + ] + link_dir_remove_list += ["/opt/rh/gcc-toolset-12/root/usr/lib64"] # Remove extra link library for crayftn if self.is_fortran_compiler("crayftn"): - link_remove_list += ["unwind"] + link_lib_remove_list += ["unwind"] # Remove injected OpenMP stub library if spec.satisfies("+openmp"): - link_remove_list += ["ompstub"] + link_lib_remove_list += ["ompstub"] - if link_remove_list: + if link_lib_remove_list: entries.append( cmake_cache_string( - "BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE", ";".join(link_remove_list) + "BLT_CMAKE_IMPLICIT_LINK_LIBRARIES_EXCLUDE", + ";".join(link_lib_remove_list), + ) + ) + + if link_dir_remove_list: + entries.append( + cmake_cache_string( + "BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE", + ";".join(link_dir_remove_list), ) ) @@ -579,7 +619,8 @@ def initconfig_hardware_entries(self): cmake_cache_string("BLT_OPENMP_LINK_FLAGS", openmp_gen_exp, description) ) - if spec.satisfies("+openmp") and spec.satisfies("+rocm") and self.spec.satisfies("%cce"): + # For cce up to version 20.0.0 + if spec.satisfies("+openmp") and spec.satisfies("+rocm") and spec.satisfies("%cce@:20"): openmp_gen_exp = ( "$<$>:" "-fopenmp=libomp>;$<$ Date: Wed, 29 Jul 2026 13:50:20 -0700 Subject: [PATCH 2/4] Define BLT_CXX_STD in the general case --- repos/spack_repo/builtin/packages/axom/package.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/repos/spack_repo/builtin/packages/axom/package.py b/repos/spack_repo/builtin/packages/axom/package.py index 18f0992b55b..b93f4bc359e 100644 --- a/repos/spack_repo/builtin/packages/axom/package.py +++ b/repos/spack_repo/builtin/packages/axom/package.py @@ -435,6 +435,8 @@ def initconfig_compiler_entries(self): if (spec.satisfies("+cpp14") or self.cxx_std == "14") and spec.satisfies("@:0.6.1"): entries.append(cmake_cache_string("BLT_CXX_STD", "c++14", "")) + else: + entries.append(cmake_cache_string("BLT_CXX_STD", f"c++{self.cxx_std}")) # Add optimization flag workaround for builds with cray compiler if spec.satisfies("%cce"): From 640d900c9220980d0cbd89b1e91b5ec77e5a60be Mon Sep 17 00:00:00 2001 From: Brian Han Date: Wed, 12 Aug 2026 08:00:59 -0700 Subject: [PATCH 3/4] Cleanup python invocation Co-authored-by: Greg Becker --- repos/spack_repo/builtin/packages/axom/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/axom/package.py b/repos/spack_repo/builtin/packages/axom/package.py index b93f4bc359e..6ab281841e6 100644 --- a/repos/spack_repo/builtin/packages/axom/package.py +++ b/repos/spack_repo/builtin/packages/axom/package.py @@ -972,5 +972,5 @@ def test_axom_sidre_installed_into_site_packages(self): import_path.append(dep_py) imports = "import axom.sidre as s; import numpy; print('axom.sidre', s.__version__)" - python = Executable(join_path(self.spec["python"].prefix.bin, "python3")) + python = self["python"].command python("-c", imports, extra_env={"PYTHONPATH": ":".join(import_path)}) From e7f39d3d90624e03f1d294c550205b4c2f30d2df Mon Sep 17 00:00:00 2001 From: Brian Han Date: Wed, 12 Aug 2026 15:53:31 -0700 Subject: [PATCH 4/4] Remove BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE C++20 logic ; mirror cxxstd variant logic --- .../builtin/packages/axom/package.py | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/repos/spack_repo/builtin/packages/axom/package.py b/repos/spack_repo/builtin/packages/axom/package.py index 6ab281841e6..5d9c8123c47 100644 --- a/repos/spack_repo/builtin/packages/axom/package.py +++ b/repos/spack_repo/builtin/packages/axom/package.py @@ -168,7 +168,13 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): variant( "cxxstd", default="20", - values=("11", "14", "17", "20"), + values=( + conditional("11", when="@:0.6.1"), + conditional("14", when="@:0.11.0"), + conditional("17", when="@:0.14.0"), + "20", + ), + multi=False, description="C++ standard to build with", ) @@ -345,13 +351,6 @@ class Axom(CachedCMakePackage, CudaPackage, ROCmPackage): # Conflicts # ----------------------------------------------------------------------- - # C++14 required as of 0.6.2 - conflicts("cxxstd=11", when="@0.6.2:") - # C++17 required as of 0.12.0 - conflicts("cxxstd=14", when="@0.12.0:") - # C++20 required as of unreleased 0.15.0 - conflicts("cxxstd=17", when="@0.15.0:") - # Conduit's cmake config files moved and < 0.4.0 can't find it conflicts("^conduit@0.7.2:", when="@:0.4.0") @@ -531,13 +530,6 @@ def initconfig_hardware_entries(self): if spec.satisfies("+fortran"): link_lib_remove_list = [] - link_dir_remove_list = [] - - if self.cxx_std == "20": - link_dir_remove_list += [ - "/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12" - ] - link_dir_remove_list += ["/opt/rh/gcc-toolset-12/root/usr/lib64"] # Remove extra link library for crayftn if self.is_fortran_compiler("crayftn"): @@ -555,14 +547,6 @@ def initconfig_hardware_entries(self): ) ) - if link_dir_remove_list: - entries.append( - cmake_cache_string( - "BLT_CMAKE_IMPLICIT_LINK_DIRECTORIES_EXCLUDE", - ";".join(link_dir_remove_list), - ) - ) - # Additional libraries for TOSS4 hip_link_flags += "-lamdhip64 -lhsakmt -lhsa-runtime64 -lamd_comgr "