Reference documentation for deal.II version Git adf7f9fdfe 2021-01-28 13:54:50 +0100
\(\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\}}\)
multithread_info.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 2018 by the deal.II authors
4 //
5 // This file is part of the deal.II library.
6 //
7 // The deal.II library is free software; you can use it, redistribute
8 // it, and/or modify it under the terms of the GNU Lesser General
9 // Public License as published by the Free Software Foundation; either
10 // version 2.1 of the License, or (at your option) any later version.
11 // The full text of the license can be found in the file LICENSE.md at
12 // the top level directory of deal.II.
13 //
14 // ---------------------------------------------------------------------
15 
16 #ifndef dealii_multithread_info_h
17 # define dealii_multithread_info_h
18 //---------------------------------------------------------------------------
19 
20 
21 # include <deal.II/base/config.h>
22 
23 # include <deal.II/base/exceptions.h>
24 # include <deal.II/base/types.h>
25 
26 # include <memory>
27 
28 // forward declaration from <taskflow/taskflow.hpp>
29 namespace tf
30 {
31  class Executor;
32 }
33 
35 
56 {
57 public:
62  MultithreadInfo() = delete;
63 
71  static unsigned int
72  n_cores();
73 
79  static unsigned int
80  n_threads();
81 
87  static std::size_t
89 
103  static void
104  set_thread_limit(
105  const unsigned int max_threads = numbers::invalid_unsigned_int);
106 
113  static bool
114  is_running_single_threaded();
115 
120  static void
121  initialize_multithreading();
122 
123 
124 # ifdef DEAL_II_WITH_TASKFLOW
125 
132  static tf::Executor &
133  get_taskflow_executor();
134 # endif
135 
136 private:
140  static unsigned int n_max_threads;
141 
142 # ifdef DEAL_II_WITH_TASKFLOW
143 
147  static std::unique_ptr<tf::Executor> executor;
148 # endif
149 };
150 
151 
152 
153 //---------------------------------------------------------------------------
155 // end of #ifndef dealii_multithread_info_h
156 #endif
157 //---------------------------------------------------------------------------
static const unsigned int invalid_unsigned_int
Definition: types.h:196
static std::unique_ptr< tf::Executor > executor
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:380
static unsigned int n_max_threads
#define DEAL_II_NAMESPACE_OPEN
Definition: config.h:379
std::enable_if< std::is_fundamental< T >::value, std::size_t >::type memory_consumption(const T &t)