Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ActsExamples::tbbWrap Namespace Reference

Classes

class  task_arena
 
class  parallel_for
 Small wrapper for tbb::parallel_for. More...
 
class  queuing_mutex
 Small wrapper for tbb::queuing_mutex and tbb::queuing_mutex::scoped_lock. More...
 

Functions

static bool enableTBB (int nthreads=-99)
 

Detailed Description

Wrapper for most of the tbb functions that we use in Sequencer.

It disables the use of tbb if nthreads=1. Note that only a small subset of tbb functions are implemented, and tbb::blocked_range (which doesn't require any thread setup) is still taken from the tbb library.

However, if ACTS_EXAMPLES_NO_TBB is defined, then don't use tbb library at all (requires nthreads=1 or -1). This allows the ACTS Examples to be built without the tbb library (and reduces the dependency on ROOT). In this case, we provide our own minimal implementation of tbb::blocked_range.

Based on an idea from https://stackoverflow.com/questions/59736661/how-to-completely-switch-off-threading-in-tbb-code

Function Documentation

static bool ActsExamples::tbbWrap::enableTBB ( int  nthreads = -99)
static

enableTBB keeps a record of whether we are multi-threaded (nthreads!=1) or not. This is set once in task_arena and stored globally. This means that enableTBB(nthreads) itself is not thread-safe. That should be fine because the task_arena is initialised before spawning any threads. If multi-threading is ever enabled, then it is not disabled.

Definition at line 69 of file tbbWrap.hpp.

View newest version in sPHENIX GitHub at line 69 of file tbbWrap.hpp

Referenced by ActsExamples::tbbWrap::parallel_for::parallel_for(), ActsExamples::tbbWrap::queuing_mutex::queuing_mutex(), ActsExamples::tbbWrap::queuing_mutex::scoped_lock::scoped_lock(), and ActsExamples::tbbWrap::task_arena::task_arena().

+ Here is the caller graph for this function: