Reference documentation for deal.II version GIT relicensing-233-g802318d791 2024-03-28 20:20:02+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: LGPL-2.1-or-later
4// Copyright (C) 2022 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#include <deal.II/base/kokkos.h>
17
20
21#include <Kokkos_Core.hpp>
22
24
25namespace internal
26{
28
29 void
31 {
32 if (!Kokkos::is_initialized()
33#if KOKKOS_VERSION >= 30700
34 && !Kokkos::is_finalized()
35#endif
36 )
37 {
38 // only execute once
39 static bool dummy = []() {
41#if KOKKOS_VERSION >= 30700
42 const auto settings =
43 Kokkos::InitializationSettings().set_num_threads(
45#else
46 const Kokkos::InitArguments settings(MultithreadInfo::n_threads());
47#endif
48 Kokkos::initialize(settings);
49 std::atexit(Kokkos::finalize);
50 return true;
51 }();
52 (void)dummy;
53 }
54 }
55} // namespace internal
static unsigned int n_threads()
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:502
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
void ensure_kokkos_initialized()
Definition kokkos.cc:30
bool dealii_initialized_kokkos
Definition kokkos.cc:27