Go to the documentation of this file.
   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/libmesh_logging.h" 
   33 #include "libmesh/ignore_warnings.h" 
   36 #include "tbb/tbb_stddef.h" 
   37 #include "tbb/blocked_range.h" 
   38 #include "tbb/parallel_for.h" 
   39 #include "tbb/parallel_reduce.h" 
   40 #include "tbb/task_scheduler_init.h" 
   41 #include "tbb/partitioner.h" 
   42 #include "tbb/spin_mutex.h" 
   43 #include "tbb/recursive_mutex.h" 
   44 #include "tbb/atomic.h" 
   45 #include "tbb/tbb_thread.h" 
   46 #include "tbb/enumerable_thread_specific.h" 
   48 #include "libmesh/restore_warnings.h" 
   50 #define TBB_VERSION_LESS_THAN(major,minor)                              \ 
   51   ((LIBMESH_DETECTED_TBB_VERSION_MAJOR < (major) ||                     \ 
   52     (LIBMESH_DETECTED_TBB_VERSION_MAJOR == (major) && (LIBMESH_DETECTED_TBB_VERSION_MINOR < (minor)))) ? 1 : 0) 
   55 #define LIBMESH_TLS_TYPE(type)  tbb::enumerable_thread_specific<type> 
   56 #define LIBMESH_TLS_REF(value)  (value).local() 
   68 typedef tbb::tbb_thread 
Thread;
 
   85 template <
typename Range, 
typename Body>
 
   87 void parallel_for (
const Range & range, 
const Body & body)
 
   91 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  104 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  116 template <
typename Range, 
typename Body, 
typename Partitioner>
 
  122 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  135 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  147 template <
typename Range, 
typename Body>
 
  153 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  166 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  178 template <
typename Range, 
typename Body, 
typename Partitioner>
 
  180 void parallel_reduce (
const Range & range, Body & body, 
const Partitioner & partitioner)
 
  184 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  197 #ifdef LIBMESH_ENABLE_PERFORMANCE_LOGGING 
  223 template <
typename T>
 
  224 class atomic : 
public tbb::atomic<T> {};
 
  230 #endif // LIBMESH_HAVE_TBB_API 
  232 #endif // LIBMESH_SQUASH_HEADER_WARNING 
  234 #endif // LIBMESH_THREADS_TBB_H 
  
Defines atomic operations which can only be executed on a single thread at a time.
 
void enable_logging()
Enables performance logging for an active object.
 
tbb::recursive_mutex recursive_mutex
Recursive mutex.
 
tbb::task_scheduler_init task_scheduler_init
Scheduler to manage threads.
 
The libMesh namespace provides an interface to certain functionality in the library.
 
The Partitioner class provides a uniform interface for partitioning algorithms.
 
bool logging_enabled() const
 
tbb::spin_mutex spin_mutex
Spin mutex.
 
NonConcurrentThread Thread
Use the non-concurrent placeholder.
 
PerfLog perflog
A PerfLog object to log performance.
 
void parallel_for(const Range &range, const Body &body)
Execute the provided function object in parallel on the specified range.
 
bool in_threads
A boolean which is true iff we are in a Threads:: function It may be useful to assert(!...
 
void disable_logging()
Disables performance logging for an active object.
 
void parallel_reduce(const Range &range, Body &body)
Execute the provided reduction operation in parallel on the specified range.
 
tbb::split split
Dummy "splitting object" used to distinguish splitting constructors from copy constructors.
 
We use a class to turn Threads::in_threads on and off, to be exception-safe.