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 63 of file RTaskArena.hxx.

Public Member Functions

 ~RTaskArenaWrapper ()
 
ROOT::ROpaqueTaskArenaAccess ()
 Provides access to the wrapped tbb::task_arena.
 

Static Public Member Functions

static unsigned TaskArenaSize ()
 

Private Member Functions

 RTaskArenaWrapper (unsigned maxConcurrency=0)
 Initializes the tbb::task_arena within RTaskArenaWrapper.
 

Private Attributes

std::unique_ptr< ROOT::ROpaqueTaskArenafTBBArena
 

Static Private Attributes

static unsigned fNWorkers = 0u
 

Friends

std::shared_ptr< ROOT::Internal::RTaskArenaWrapperGetGlobalTaskArena (unsigned maxConcurrency)
 Factory function returning a shared pointer to the instance of the global RTaskArenaWrapper.
 

#include <ROOT/RTaskArena.hxx>

Constructor & Destructor Documentation

◆ ~RTaskArenaWrapper()

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

Definition at line 90 of file RTaskArena.cxx.

◆ RTaskArenaWrapper()

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

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 72 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 104 of file RTaskArena.cxx.

◆ TaskArenaSize()

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

Definition at line 97 of file RTaskArena.cxx.

Friends And Related Symbol Documentation

◆ GetGlobalTaskArena

std::shared_ptr< ROOT::Internal::RTaskArenaWrapper > GetGlobalTaskArena ( unsigned  maxConcurrency = 0)
friend

Factory function returning a shared pointer to the instance of the global RTaskArenaWrapper.

Allows for reinstantiation of the global RTaskArenaWrapper once all the references to the previous one are gone and the object destroyed.

Definition at line 109 of file RTaskArena.cxx.

Member Data Documentation

◆ fNWorkers

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

Definition at line 72 of file RTaskArena.hxx.

◆ fTBBArena

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

Definition at line 71 of file RTaskArena.hxx.

Libraries for ROOT::Internal::RTaskArenaWrapper:

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