Demonstrate how to activate and use the implicit parallelisation of TTree::GetEntry.
Such parallelisation creates one task per top-level branch of the tree being read. In this example, most of the branches are floating point numbers, which are very fast to read. This parallelisation can be used, though, on bigger trees with many (complex) branches, which are more likely to benefit from speedup gains.
int imt001_parBranchProcessing()
{
int nthreads = 4;
const auto nEntries =
tree->GetEntries();
for (
auto i :
ROOT::TSeqUL(nEntries)) {
}
tree->SetImplicitMT(
false);
for (
auto i :
ROOT::TSeqUL(nEntries)) {
}
tree->SetImplicitMT(
true);
}
return 0;
}
static TFile * Open(const char *name, Option_t *option="", const char *ftitle="", Int_t compress=ROOT::RCompressionSetting::EDefaults::kUseCompiledDefault, Int_t netopt=0)
Create / open a file.
A TTree represents a columnar dataset.
This file contains a specialised ROOT message handler to test for diagnostic in unit tests.
void EnableImplicitMT(UInt_t numthreads=0)
Enable ROOT's implicit multi-threading for all objects and methods that provide an internal paralleli...
TSeq< unsigned long > TSeqUL
void DisableImplicitMT()
Disables the implicit multi-threading in ROOT (see EnableImplicitMT).
- Date
- 26/09/2016
- Author
- Enric Tejedor
Definition in file imt001_parBranchProcessing.C.