From df013094da3970aa9c2ae8caf263a331c7655b99 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 14 Oct 2025 15:53:02 -0700 Subject: [PATCH 1/5] basic clean up in spack package --- scripts/spack/packages/serac/package.py | 78 +++++++++++++------------ 1 file changed, 41 insertions(+), 37 deletions(-) diff --git a/scripts/spack/packages/serac/package.py b/scripts/spack/packages/serac/package.py index ca80e7e73..643122840 100644 --- a/scripts/spack/packages/serac/package.py +++ b/scripts/spack/packages/serac/package.py @@ -96,15 +96,16 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on('enzyme@0.0.180', when="+enzyme") # Devtool dependencies these need to match serac_devtools/package.py - depends_on("cppcheck", when="+devtools") - depends_on("doxygen", when="+devtools") - depends_on("llvm@19+clang", when="+devtools") - depends_on("python", when="+devtools") - depends_on("py-sphinx", when="+devtools") + with when("+devtools"): + depends_on("cppcheck") + depends_on("doxygen") + depends_on("llvm@19+clang") + depends_on("python") + depends_on("py-sphinx") with when("+sundials"): # Going to sundials@7: causes 80%+ test failures - depends_on("sundials@:6.999", when="+sundials") + depends_on("sundials@:6.999") # MFEM is deprecating the monitoring support with sundials v6.0 and later # NOTE: Sundials must be built static to prevent the following runtime error: # "error while loading shared libraries: libsundials_nvecserial.so.6: @@ -126,20 +127,22 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("hypre@2.26.0:~superlu-dist+mpi") - depends_on("petsc", when="+petsc") - depends_on("petsc+strumpack", when="+petsc+strumpack") - depends_on("petsc~strumpack", when="+petsc~strumpack") - depends_on("petsc+openmp", when="+petsc+openmp") - depends_on("petsc~openmp", when="+petsc~openmp") - depends_on("slepc+arpack", when="+slepc") - - depends_on("tribol", when="+tribol") - depends_on("tribol+raja", when="+raja") - depends_on("tribol~raja", when="~raja") - depends_on("tribol+umpire", when="+umpire") - depends_on("tribol~umpire", when="~umpire") - depends_on("tribol+enzyme", when="+enzyme") - depends_on("tribol~enzyme", when="~enzyme") + with when("+petsc"): + depends_on("petsc") + depends_on("petsc+strumpack", when="+strumpack") + depends_on("petsc~strumpack", when="~strumpack") + depends_on("petsc+openmp", when="+openmp") + depends_on("petsc~openmp", when="~openmp") + depends_on("slepc+arpack", when="+slepc") + + with when("+tribol"): + depends_on("tribol") + depends_on("tribol+raja", when="+raja") + depends_on("tribol~raja", when="~raja") + depends_on("tribol+umpire", when="+umpire") + depends_on("tribol~umpire", when="~umpire") + depends_on("tribol+enzyme", when="+enzyme") + depends_on("tribol~enzyme", when="~enzyme") # Needs to be first due to a bug with the Spack concretizer # Note: Certain combinations of CMake and Conduit do not like +mpi @@ -149,15 +152,17 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("camp@2024.02.0:") - depends_on("raja@2024.02.0:~examples~exercises", when="+raja") - depends_on("raja~openmp", when="+raja~openmp") - depends_on("raja+openmp", when="+raja+openmp") + with when("+raja"): + depends_on("raja@2024.02.0:~examples~exercises") + depends_on("raja+openmp", when="+openmp") + depends_on("raja~openmp", when="~openmp") - depends_on("umpire@2024.02.0:~examples~device_alloc", when="+umpire") - depends_on("umpire~openmp", when="+umpire~openmp") - depends_on("umpire+openmp", when="+umpire+openmp") + with when("+umpire"): + depends_on("umpire@2024.02.0:~examples~device_alloc") + depends_on("umpire+openmp", when="+openmp") + depends_on("umpire~openmp", when="~openmp") - depends_on("axom@0.9:~fortran~tools~examples+mfem+lua") + depends_on("axom@0.10:~fortran~tools~examples+mfem+lua") depends_on("axom+raja", when="+raja") depends_on("axom~raja", when="~raja") depends_on("axom+umpire", when="+umpire") @@ -170,15 +175,17 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("conduit~python~test") - depends_on("adiak+mpi", when="+profiling") - depends_on("caliper+mpi+adiak~papi", when="+profiling") + with when("+profiling"): + depends_on("adiak+mpi") + depends_on("caliper+mpi+adiak~papi") depends_on("superlu-dist@8.1.2") # The optional slate dependency is not handled in the MFEM spack package - depends_on("strumpack~slate~butterflypack~zfp", when="+strumpack") - depends_on("strumpack+openmp", when="+strumpack+openmp") - depends_on("strumpack~openmp", when="+strumpack~openmp") + with when("+strumpack"): + depends_on("strumpack~slate~butterflypack~zfp") + depends_on("strumpack+openmp", when="+openmp") + depends_on("strumpack~openmp", when="~openmp") # # Forward variants @@ -242,8 +249,8 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): depends_on("{0}~shared".format(dep), when="~shared") # MFEM has a static variant - depends_on("{0}+static".format("mfem"), when="~shared") - depends_on("{0}~static".format("mfem"), when="+shared") + depends_on("mfem+static", when="~shared") + depends_on("mfem~static", when="+shared") # # Conflicts @@ -261,9 +268,6 @@ class Serac(CachedCMakePackage, CudaPackage, ROCmPackage): conflicts("~petsc", when="+slepc", msg="PETSc must be built when building with SLEPc!") - conflicts("sundials@:6.0.0", when="+sundials", - msg="Sundials needs to be greater than 6.0.0") - conflicts("sundials+shared", when="+sundials", msg="Sundials causes runtime errors if shared!") From 223da1939f89b8fb8480b8c3d1d29612b250a821 Mon Sep 17 00:00:00 2001 From: Chris White Date: Tue, 14 Oct 2025 15:53:25 -0700 Subject: [PATCH 2/5] add test for ApplicationManager --- src/serac/infrastructure/tests/CMakeLists.txt | 1 + .../tests/application_manager.cpp | 33 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 src/serac/infrastructure/tests/application_manager.cpp diff --git a/src/serac/infrastructure/tests/CMakeLists.txt b/src/serac/infrastructure/tests/CMakeLists.txt index 4942c51cf..b6c82575d 100644 --- a/src/serac/infrastructure/tests/CMakeLists.txt +++ b/src/serac/infrastructure/tests/CMakeLists.txt @@ -7,6 +7,7 @@ set(infrastructure_test_depends serac_physics gtest) set(infrastructure_test_sources + application_manager.cpp debug_print.cpp error_handling.cpp input.cpp diff --git a/src/serac/infrastructure/tests/application_manager.cpp b/src/serac/infrastructure/tests/application_manager.cpp new file mode 100644 index 000000000..7532a1000 --- /dev/null +++ b/src/serac/infrastructure/tests/application_manager.cpp @@ -0,0 +1,33 @@ +// Copyright (c) Lawrence Livermore National Security, LLC and +// other Serac Project Developers. See the top-level LICENSE file for +// details. +// +// SPDX-License-Identifier: (BSD-3-Clause) + +#include "gtest/gtest.h" + +#include "serac/serac_config.hpp" +#include "serac/infrastructure/application_manager.hpp" + +namespace { + // Stash copies that tests can read (after gtest strips its flags) + int g_argc = 0; + char** g_argv = nullptr; +} + +namespace serac { + +TEST(ApplicationManager, Lifetime) +{ + serac::ApplicationManager applicationManager(g_argc, g_argv); +} + +} // namespace serac + +int main(int argc, char* argv[]) +{ + ::testing::InitGoogleTest(&argc, argv); // removes --gtest_* flags + g_argc = argc; // store leftovers for tests + g_argv = argv; + return RUN_ALL_TESTS(); +} From fc0b4004cdfae1e3808db128ac273d5ebdbc9784 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 15 Oct 2025 16:29:56 -0700 Subject: [PATCH 3/5] clean up cmake dependencies in infrastructure tests --- src/serac/infrastructure/tests/CMakeLists.txt | 15 +++++++++++---- .../infrastructure/tests/application_manager.cpp | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/serac/infrastructure/tests/CMakeLists.txt b/src/serac/infrastructure/tests/CMakeLists.txt index b6c82575d..3784f14da 100644 --- a/src/serac/infrastructure/tests/CMakeLists.txt +++ b/src/serac/infrastructure/tests/CMakeLists.txt @@ -4,14 +4,21 @@ # # SPDX-License-Identifier: (BSD-3-Clause) -set(infrastructure_test_depends serac_physics gtest) +set(infrastructure_test_depends serac_infrastructure gtest) set(infrastructure_test_sources application_manager.cpp debug_print.cpp - error_handling.cpp - input.cpp - profiling.cpp) + input.cpp) serac_add_tests( SOURCES ${infrastructure_test_sources} DEPENDS_ON ${infrastructure_test_depends}) + + +# Infrastructure tests that require more than just infrastructure + +serac_add_tests( SOURCES error_handling.cpp + DEPENDS_ON serac_physics ${infrastructure_test_depends}) + +serac_add_tests( SOURCES profiling.cpp + DEPENDS_ON serac_mesh_utils ${infrastructure_test_depends}) diff --git a/src/serac/infrastructure/tests/application_manager.cpp b/src/serac/infrastructure/tests/application_manager.cpp index 7532a1000..e68300f64 100644 --- a/src/serac/infrastructure/tests/application_manager.cpp +++ b/src/serac/infrastructure/tests/application_manager.cpp @@ -27,7 +27,7 @@ TEST(ApplicationManager, Lifetime) int main(int argc, char* argv[]) { ::testing::InitGoogleTest(&argc, argv); // removes --gtest_* flags - g_argc = argc; // store leftovers for tests + g_argc = argc; // store leftovers for tests g_argv = argv; return RUN_ALL_TESTS(); } From 84467fa6209c99bd6ffb3ae94d7e42be0c46c7e8 Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 15 Oct 2025 16:57:57 -0700 Subject: [PATCH 4/5] comment code --- src/serac/infrastructure/tests/application_manager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/serac/infrastructure/tests/application_manager.cpp b/src/serac/infrastructure/tests/application_manager.cpp index e68300f64..b263cd2b8 100644 --- a/src/serac/infrastructure/tests/application_manager.cpp +++ b/src/serac/infrastructure/tests/application_manager.cpp @@ -19,6 +19,8 @@ namespace serac { TEST(ApplicationManager, Lifetime) { + // This test is useful for showing problems with the RAII nature of this class + // Specifically anyone calling MPI after we call MPI_finalize serac::ApplicationManager applicationManager(g_argc, g_argv); } From 64569c9f4832ab6f1d509e80ab47eda2c6f6184a Mon Sep 17 00:00:00 2001 From: Chris White Date: Wed, 15 Oct 2025 17:22:27 -0700 Subject: [PATCH 5/5] style --- .../infrastructure/tests/application_manager.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/serac/infrastructure/tests/application_manager.cpp b/src/serac/infrastructure/tests/application_manager.cpp index b263cd2b8..37b5f6708 100644 --- a/src/serac/infrastructure/tests/application_manager.cpp +++ b/src/serac/infrastructure/tests/application_manager.cpp @@ -10,19 +10,14 @@ #include "serac/infrastructure/application_manager.hpp" namespace { - // Stash copies that tests can read (after gtest strips its flags) - int g_argc = 0; - char** g_argv = nullptr; -} +// Stash copies that tests can read (after gtest strips its flags) +int g_argc = 0; +char** g_argv = nullptr; +} // namespace namespace serac { -TEST(ApplicationManager, Lifetime) -{ - // This test is useful for showing problems with the RAII nature of this class - // Specifically anyone calling MPI after we call MPI_finalize - serac::ApplicationManager applicationManager(g_argc, g_argv); -} +TEST(ApplicationManager, Lifetime) { serac::ApplicationManager applicationManager(g_argc, g_argv); } } // namespace serac