Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Internal::RTaskArenaWrapper Class Reference

Wrapper for tbb::task_arena.

Wrapper over tbb::task_arena.

Necessary in order to keep tbb away from ROOT headers. This class is thought out to be used as a singleton.

This class is a wrapper over tbb::task_arena, in order to keep TBB away from ROOT's headers. We keep a single global instance to be used by any parallel ROOT class with TBB as a backend.

TThreadExecutor, IMT and any class relying on TBB will get a pointer to the scheduler through ROOT::Internal::GetGlobalTaskArena(), which will return areference to the only pointer to the TBB scheduler that will be active in any ROOT Process.

Examples:

root[] auto gTA = ROOT::Internal::GetGlobalTaskArena(nWorkers) //get a shared_ptr to the global arena and initialize
//it with nWorkers. Enable thread safety in ROOT
root[] gTA->TaskArenaSize() // Get the current size of the arena (number of worker threads)
root[] gTA->Access() //std::unique_ptr to the internal tbb::task_arena for interacting directly with it (needed to
//call operations such as execute)
root[] gTA->Access().max_concurrency() // call to tbb::task_arena::max_concurrency()
std::shared_ptr< ROOT::Internal::RTaskArenaWrapper > GetGlobalTaskArena(unsigned maxConcurrency=0)
Factory function returning a shared pointer to the instance of the global RTaskArenaWrapper.

Definition at line 64 of file RTaskArena.hxx.

Classes

struct  Attach
 Marker for attaching to an existing tbb::task_arena. More...
 

Public Member Functions

 RTaskArenaWrapper (Attach)
 Initializes the tbb::task_arena within RTaskArenaWrapper by attaching to an existing arena.
 
 RTaskArenaWrapper (unsigned maxConcurrency=0)
 Initializes the tbb::task_arena within RTaskArenaWrapper.
 
 ~RTaskArenaWrapper ()
 
ROOT::ROpaqueTaskArenaAccess ()
 Provides access to the wrapped tbb::task_arena.
 

Static Public Member Functions

static unsigned TaskArenaSize ()
 

Private Attributes

std::unique_ptr< ROOT::ROpaqueTaskArenafTBBArena
 

Static Private Attributes

static unsigned fNWorkers = 0u
 

Friends

std::shared_ptr< ROOT::Internal::RTaskArenaWrapperGetGlobalTaskArena (unsigned, ROOT::EIMTConfig)
 

#include <ROOT/RTaskArena.hxx>

Constructor & Destructor Documentation

◆ ~RTaskArenaWrapper()

ROOT::Internal::RTaskArenaWrapper::~RTaskArenaWrapper ( )

Definition at line 125 of file RTaskArena.cxx.

◆ RTaskArenaWrapper() [1/2]

ROOT::Internal::RTaskArenaWrapper::RTaskArenaWrapper ( unsigned maxConcurrency = 0)

Initializes the tbb::task_arena within RTaskArenaWrapper.

  • Can't be reinitialized
  • Checks for CPU bandwidth control and avoids oversubscribing
  • If no BC in place and maxConcurrency<1, defaults to the default tbb number of threads, which is CPU affinity aware

Definition at line 93 of file RTaskArena.cxx.

◆ RTaskArenaWrapper() [2/2]

ROOT::Internal::RTaskArenaWrapper::RTaskArenaWrapper ( RTaskArenaWrapper::Attach )

Initializes the tbb::task_arena within RTaskArenaWrapper by attaching to an existing arena.

  • Can't be reinitialized

Definition at line 117 of file RTaskArena.cxx.

Member Function Documentation

◆ Access()

ROOT::ROpaqueTaskArena & ROOT::Internal::RTaskArenaWrapper::Access ( )

Provides access to the wrapped tbb::task_arena.

Definition at line 139 of file RTaskArena.cxx.

◆ TaskArenaSize()

unsigned ROOT::Internal::RTaskArenaWrapper::TaskArenaSize ( )
static

Definition at line 132 of file RTaskArena.cxx.

Friends And Related Symbol Documentation

◆ GetGlobalTaskArena

std::shared_ptr< ROOT::Internal::RTaskArenaWrapper > GetGlobalTaskArena ( unsigned maxConcurrency,
ROOT::EIMTConfig config )
friend

Definition at line 145 of file RTaskArena.cxx.

Member Data Documentation

◆ fNWorkers

unsigned ROOT::Internal::RTaskArenaWrapper::fNWorkers = 0u
staticprivate

Definition at line 77 of file RTaskArena.hxx.

◆ fTBBArena

std::unique_ptr<ROOT::ROpaqueTaskArena> ROOT::Internal::RTaskArenaWrapper::fTBBArena
private

Definition at line 76 of file RTaskArena.hxx.

Libraries for ROOT::Internal::RTaskArenaWrapper:

The documentation for this class was generated from the following files: