19 #ifndef LIBMESH_THREADS_TBB_H 20 #define LIBMESH_THREADS_TBB_H 24 #ifndef LIBMESH_SQUASH_HEADER_WARNING 25 # warning "This file is designed to be included through libmesh/threads.h" 28 #ifdef LIBMESH_HAVE_TBB_API 31 #include "libmesh/ignore_warnings.h" 34 #include "tbb/tbb_stddef.h" 35 #include "tbb/blocked_range.h" 36 #include "tbb/parallel_for.h" 37 #include "tbb/parallel_reduce.h" 38 #include "tbb/task_scheduler_init.h" 39 #include "tbb/partitioner.h" 40 #include "tbb/spin_mutex.h" 41 #include "tbb/recursive_mutex.h" 42 #include "tbb/atomic.h" 43 #include "tbb/tbb_thread.h" 44 #include "tbb/enumerable_thread_specific.h" 46 #include "libmesh/restore_warnings.h" 48 #define TBB_VERSION_LESS_THAN(major,minor) \ 49 ((LIBMESH_DETECTED_TBB_VERSION_MAJOR < (major) || \ 50 (LIBMESH_DETECTED_TBB_VERSION_MAJOR == (major) && (LIBMESH_DETECTED_TBB_VERSION_MINOR < (minor)))) ? 1 : 0) 53 #define LIBMESH_TLS_TYPE(type) tbb::enumerable_thread_specific<type> 54 #define LIBMESH_TLS_REF(value) (value).local() 66 typedef tbb::tbb_thread
Thread;
83 template <
typename Range,
typename Body>
85 void parallel_for (
const Range & range,
const Body & body)
104 template <
typename Range,
typename Body,
typename Partitioner>
112 DisablePerfLogInScope disable_perf;
125 template <
typename Range,
typename Body>
133 DisablePerfLogInScope disable_perf;
146 template <
typename Range,
typename Body,
typename Partitioner>
148 void parallel_reduce (
const Range & range, Body & body,
const Partitioner & partitioner)
154 DisablePerfLogInScope disable_perf;
181 template <
typename T>
182 class atomic :
public tbb::atomic<T> {};
188 #endif // LIBMESH_HAVE_TBB_API 190 #endif // LIBMESH_SQUASH_HEADER_WARNING 192 #endif // LIBMESH_THREADS_TBB_H NonConcurrentThread Thread
Use the non-concurrent placeholder.
void parallel_for(const Range &range, const Body &body)
Execute the provided function object in parallel on the specified range.
The libMesh namespace provides an interface to certain functionality in the library.
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!Threadsin_thre...
We use a class to turn perf logging off and on within threads, to be exception-safe and to avoid forc...
The Partitioner class provides a uniform interface for partitioning algorithms.
tbb::task_scheduler_init task_scheduler_init
Scheduler to manage threads.
tbb::spin_mutex spin_mutex
Spin mutex.
tbb::split split
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
Defines atomic operations which can only be executed on a single thread at a time.
We use a class to turn Threads::in_threads on and off, to be exception-safe.
void parallel_reduce(const Range &range, Body &body)
Execute the provided reduction operation in parallel on the specified range.
tbb::recursive_mutex recursive_mutex
Recursive mutex.