Reference documentation for deal.II version GIT b6bf1e606d 2022-08-11 15:25: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\}}\)
multithread_info.h
Go to the documentation of this file.
1 // ---------------------------------------------------------------------
2 //
3 // Copyright (C) 2000 - 2021 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 # ifdef DEAL_II_WITH_TASKFLOW
29 // forward declaration from <taskflow/taskflow.hpp>
30 namespace tf
31 {
32  class Executor;
33 }
34 # endif
35 
36 
38 
59 {
60 public:
65  MultithreadInfo() = delete;
66 
74  static unsigned int
75  n_cores();
76 
82  static unsigned int
83  n_threads();
84 
90  static std::size_t
92 
106  static void
108  const unsigned int max_threads = numbers::invalid_unsigned_int);
109 
116  static bool
118 
123  static void
125 
126 
127 # ifdef DEAL_II_WITH_TASKFLOW
135  static tf::Executor &
137 # endif
138 
139 private:
143  static unsigned int n_max_threads;
144 
145 # ifdef DEAL_II_WITH_TASKFLOW
150  static std::unique_ptr<tf::Executor> executor;
151 # endif
152 };
153 
154 
155 
156 //---------------------------------------------------------------------------
158 // end of #ifndef dealii_multithread_info_h
159 #endif
160 //---------------------------------------------------------------------------
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:442
#define DEAL_II_NAMESPACE_CLOSE
Definition: config.h:443
static const unsigned int invalid_unsigned_int
Definition: types.h:201