From ae35947905973865bd06d1ae6bd8b547f89c588d Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Thu, 9 Mar 2023 17:46:37 -0500 Subject: [PATCH] Backport to Kokkos before 3.7.00 --- source/base/kokkos.cc | 4 ++++ source/base/mpi.cc | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/source/base/kokkos.cc b/source/base/kokkos.cc index 18f41861fa..d1e7742bc2 100644 --- a/source/base/kokkos.cc +++ b/source/base/kokkos.cc @@ -35,9 +35,13 @@ namespace internal // only execute once static bool dummy = [] { dealii_initialized_kokkos = true; +#if KOKKOS_VERSION >= 30700 const auto settings = Kokkos::InitializationSettings().set_num_threads( MultithreadInfo::n_threads()); +#else + const Kokkos::InitArguments settings(MultithreadInfo::n_threads()); +#endif Kokkos::initialize(settings); std::atexit(Kokkos::finalize); return true; diff --git a/source/base/mpi.cc b/source/base/mpi.cc index cd06ceaadd..0e0454697c 100644 --- a/source/base/mpi.cc +++ b/source/base/mpi.cc @@ -781,7 +781,11 @@ namespace Utilities for (int i = 0; i < argc; ++i) argv_new.push_back(argv[i]); std::stringstream threads_flag; +#if KOKKOS_VERSION >= 30700 + threads_flag << "--kokkos-num-threads=" << MultithreadInfo::n_threads(); +#else threads_flag << "--kokkos-threads=" << MultithreadInfo::n_threads(); +#endif argv_new.push_back(const_cast(threads_flag.str().c_str())); argv_new.push_back(nullptr); int argc_new = argc + 1; -- 2.39.5