deal.II version GIT relicensing-6834-g5b78e6bcdf 2026-10-01 11:20:01+00:00
\(\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}}\) \(\newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=}\) \(\newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]}\) \(\newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}\)
Loading...
Searching...
No Matches
kokkos.cc
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception OR LGPL-2.1-or-later
4// Copyright (C) 2022 - 2025 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Detailed license information governing the source code and contributions
9// can be found in LICENSE.md and CONTRIBUTING.md at the top level directory.
10//
11// -----------------------------------------------------------------------------
12
13#include <deal.II/base/kokkos.h>
15
18
19#include <Kokkos_Core.hpp>
20
22
23namespace internal
24{
26
27 void
29 {
30 if (!Kokkos::is_initialized()
32 && !Kokkos::is_finalized()
33#endif
34 )
35 {
36 // only execute once
37 static bool dummy = []() {
39#if DEAL_II_KOKKOS_VERSION_GTE(3, 7, 0)
40 const auto settings =
41 Kokkos::InitializationSettings().set_num_threads(
43#else
44 const Kokkos::InitArguments settings(MultithreadInfo::n_threads());
45#endif
46 Kokkos::initialize(settings);
47 std::atexit(Kokkos::finalize);
48 return true;
49 }();
50 (void)dummy;
51 }
52 }
53} // namespace internal
static unsigned int n_threads()
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
#define DEAL_II_KOKKOS_VERSION_GTE(major, minor, subminor)
Definition config.h:478
void ensure_kokkos_initialized()
Definition kokkos.cc:28
bool dealii_initialized_kokkos
Definition kokkos.cc:25