iMSTK
Interactive Medical Simulation Toolkit
All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
imstkThreadManager.h
1 /*
2 ** This file is part of the Interactive Medical Simulation Toolkit (iMSTK)
3 ** iMSTK is distributed under the Apache License, Version 2.0.
4 ** See accompanying NOTICE for details.
5 */
6 
7 #pragma once
8 
9 #include "imstkMacros.h"
10 
11 DISABLE_WARNING_PUSH
12  DISABLE_WARNING_PADDING
13 #include <tbb/tbb.h>
14 #include <tbb/global_control.h>
15 DISABLE_WARNING_POP
16 
17 namespace imstk
18 {
19 namespace ParallelUtils
20 {
22 {
23 public:
27  static void setThreadPoolSize(const size_t nThreads);
28 
32  static void setOptimalParallelism();
33 
37  static size_t getThreadPoolSize();
38 
39 private:
43  static std::unique_ptr<tbb::global_control> s_tbbGlobalControl;
44 };
45 } // end namespace ParallelUtils
46 } // end namespace imstk
static void setThreadPoolSize(const size_t nThreads)
Set system-wide thread pool size for parallel computation.
Compound Geometry.
static size_t getThreadPoolSize()
Returns the size of the thread pool.
static void setOptimalParallelism()
Set system-wide thread pool size to the optimal value (use all logical cores)