version GIT relicensing-7278-g091132d5eb 2026-12-02 03:10: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
multithread_info.h
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) 2000 - 2021 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#ifndef dealii_multithread_info_h
14#define dealii_multithread_info_h
15//---------------------------------------------------------------------------
16
17
18#include <deal.II/base/config.h>
19
21#include <deal.II/base/types.h>
22
23#include <memory>
24
25// Forward-declare tf::Executor from <taskflow/taskflow.hpp>. Module builds
26// include the header instead because forward declarations are not allowed in
27// the global module fragment.
28#ifdef DEAL_II_WITH_TASKFLOW
29# ifdef DEAL_II_BUILDING_CXX20_MODULE
30# include <taskflow/core/executor.hpp>
31# else
32namespace tf
33{
34 class Executor;
35}
36# endif
37#endif
38
39
41
62{
63public:
68 MultithreadInfo() = delete;
69
77 static unsigned int
78 n_cores();
79
85 static unsigned int
86 n_threads();
87
93 static std::size_t
95
109 static void
111 const unsigned int max_threads = numbers::invalid_unsigned_int);
112
119 static bool
121
126 static void
128
129
130#ifdef DEAL_II_WITH_TASKFLOW
138 static tf::Executor &
140#endif
141
142private:
146 static unsigned int n_max_threads;
147
148#ifdef DEAL_II_WITH_TASKFLOW
153 static std::unique_ptr<tf::Executor> executor;
154#endif
155};
156
157
158
159//---------------------------------------------------------------------------
161// end of #ifndef dealii_multithread_info_h
162#endif
163//---------------------------------------------------------------------------
static unsigned int n_max_threads
MultithreadInfo()=delete
static bool is_running_single_threaded()
static std::unique_ptr< tf::Executor > executor
static void initialize_multithreading()
static unsigned int n_cores()
static unsigned int n_threads()
static void set_thread_limit(const unsigned int max_threads=numbers::invalid_unsigned_int)
static std::size_t memory_consumption()
static tf::Executor & get_taskflow_executor()
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:38
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:39
constexpr unsigned int invalid_unsigned_int
Definition types.h:228