From: Daniel Arndt Date: Tue, 20 Jun 2023 17:52:12 +0000 (-0400) Subject: Fix ArborX tests for Trilinos 14/Kokkos 4 X-Git-Tag: v9.5.0-rc1~79^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F15391%2Fhead;p=dealii.git Fix ArborX tests for Trilinos 14/Kokkos 4 --- diff --git a/source/base/kokkos.cc b/source/base/kokkos.cc index 66cfaef7b5..6380fad4ec 100644 --- a/source/base/kokkos.cc +++ b/source/base/kokkos.cc @@ -30,7 +30,11 @@ namespace internal void ensure_kokkos_initialized() { - if (!Kokkos::is_initialized()) + if (!Kokkos::is_initialized() +#if KOKKOS_VERSION >= 30700 + && !Kokkos::is_finalized() +#endif + ) { // only execute once static bool dummy = [] { diff --git a/tests/arborx/distributed_tree_intersect.cc b/tests/arborx/distributed_tree_intersect.cc index e388b5490f..b3ec93a610 100644 --- a/tests/arborx/distributed_tree_intersect.cc +++ b/tests/arborx/distributed_tree_intersect.cc @@ -187,8 +187,6 @@ test_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); Utilities::MPI::MPI_InitFinalize mpi_init(argc, argv); initlog(); @@ -196,6 +194,4 @@ main(int argc, char **argv) // tests test_2d(); test_3d(); - - Kokkos::finalize(); } diff --git a/tests/arborx/distributed_tree_nearest.cc b/tests/arborx/distributed_tree_nearest.cc index b234451be1..7919abbbea 100644 --- a/tests/arborx/distributed_tree_nearest.cc +++ b/tests/arborx/distributed_tree_nearest.cc @@ -323,8 +323,6 @@ test_point_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); Utilities::MPI::MPI_InitFinalize mpi_init(argc, argv); initlog(); @@ -334,6 +332,4 @@ main(int argc, char **argv) test_bounding_box_3d(); test_point_2d(); test_point_3d(); - - Kokkos::finalize(); } diff --git a/tests/arborx/point_intersect.cc b/tests/arborx/point_intersect.cc index ca972f7bb6..e0ff970f26 100644 --- a/tests/arborx/point_intersect.cc +++ b/tests/arborx/point_intersect.cc @@ -170,9 +170,6 @@ test_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); - initlog(); // Initialize ArborX @@ -181,6 +178,4 @@ main(int argc, char **argv) // tests test_2d(); test_3d(); - - Kokkos::finalize(); } diff --git a/tests/arborx/point_nearest.cc b/tests/arborx/point_nearest.cc index 1e9af5ee6e..31e89f5bc9 100644 --- a/tests/arborx/point_nearest.cc +++ b/tests/arborx/point_nearest.cc @@ -283,9 +283,6 @@ test_points_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); - initlog(); // Initialize ArborX @@ -296,6 +293,4 @@ main(int argc, char **argv) test_bounding_box_3d(); test_points_2d(); test_points_3d(); - - Kokkos::finalize(); } diff --git a/tests/arborx/sphere_intersect.cc b/tests/arborx/sphere_intersect.cc index 7c6d11b665..a9a807d18d 100644 --- a/tests/arborx/sphere_intersect.cc +++ b/tests/arborx/sphere_intersect.cc @@ -144,9 +144,6 @@ test_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); - initlog(); // Initialize ArborX @@ -155,6 +152,4 @@ main(int argc, char **argv) // tests test_2d(); test_3d(); - - Kokkos::finalize(); } diff --git a/tests/arborx/sphere_nearest.cc b/tests/arborx/sphere_nearest.cc index 700d201f3d..dae5af87c3 100644 --- a/tests/arborx/sphere_nearest.cc +++ b/tests/arborx/sphere_nearest.cc @@ -143,9 +143,6 @@ test_3d() int main(int argc, char **argv) { - // Initialize Kokkos - Kokkos::initialize(argc, argv); - initlog(); // Initialize ArborX @@ -154,6 +151,4 @@ main(int argc, char **argv) // tests test_2d(); test_3d(); - - Kokkos::finalize(); }