Skip to content
Snippets Groups Projects
Commit da68dfa1 authored by Enrico Guiraud's avatar Enrico Guiraud
Browse files

[TDF] When looping, honor the implicitMT setting present at construction

parent 00518437
Branches
Tags
No related merge requests found
...@@ -83,7 +83,7 @@ using RangeBaseVec_t = std::vector<RangeBasePtr_t>; ...@@ -83,7 +83,7 @@ using RangeBaseVec_t = std::vector<RangeBasePtr_t>;
class TLoopManager : public std::enable_shared_from_this<TLoopManager> { class TLoopManager : public std::enable_shared_from_this<TLoopManager> {
using TDataSource = ROOT::Experimental::TDF::TDataSource; using TDataSource = ROOT::Experimental::TDF::TDataSource;
enum class ELoopType { kROOTFiles, kNoFiles, kDataSource }; enum class ELoopType { kROOTFiles, kROOTFilesMT, kNoFiles, kNoFilesMT, kDataSource, kDataSourceMT };
using Callback_t = std::function<void(unsigned int)>; using Callback_t = std::function<void(unsigned int)>;
class TLoopCallback { class TLoopCallback {
......
...@@ -117,17 +117,20 @@ unsigned int TSlotStack::GetSlot() ...@@ -117,17 +117,20 @@ unsigned int TSlotStack::GetSlot()
TLoopManager::TLoopManager(TTree *tree, const ColumnNames_t &defaultBranches) TLoopManager::TLoopManager(TTree *tree, const ColumnNames_t &defaultBranches)
: fTree(std::shared_ptr<TTree>(tree, [](TTree *) {})), fDefaultColumns(defaultBranches), : fTree(std::shared_ptr<TTree>(tree, [](TTree *) {})), fDefaultColumns(defaultBranches),
fNSlots(TDFInternal::GetNSlots()), fLoopType(ELoopType::kROOTFiles) fNSlots(TDFInternal::GetNSlots()),
fLoopType(ROOT::IsImplicitMTEnabled() ? ELoopType::kROOTFilesMT : ELoopType::kROOTFiles)
{ {
} }
TLoopManager::TLoopManager(ULong64_t nEmptyEntries) TLoopManager::TLoopManager(ULong64_t nEmptyEntries)
: fNEmptyEntries(nEmptyEntries), fNSlots(TDFInternal::GetNSlots()), fLoopType(ELoopType::kNoFiles) : fNEmptyEntries(nEmptyEntries), fNSlots(TDFInternal::GetNSlots()),
fLoopType(ROOT::IsImplicitMTEnabled() ? ELoopType::kNoFilesMT : ELoopType::kNoFiles)
{ {
} }
TLoopManager::TLoopManager(std::unique_ptr<TDataSource> ds, const ColumnNames_t &defaultBranches) TLoopManager::TLoopManager(std::unique_ptr<TDataSource> ds, const ColumnNames_t &defaultBranches)
: fDefaultColumns(defaultBranches), fNSlots(TDFInternal::GetNSlots()), fLoopType(ELoopType::kDataSource), : fDefaultColumns(defaultBranches), fNSlots(TDFInternal::GetNSlots()),
fLoopType(ROOT::IsImplicitMTEnabled() ? ELoopType::kDataSourceMT : ELoopType::kDataSource),
fDataSource(std::move(ds)) fDataSource(std::move(ds))
{ {
fDataSource->SetNSlots(fNSlots); fDataSource->SetNSlots(fNSlots);
...@@ -356,23 +359,14 @@ void TLoopManager::Run() ...@@ -356,23 +359,14 @@ void TLoopManager::Run()
InitNodes(); InitNodes();
#ifdef R__USE_IMT switch (fLoopType) {
if (ROOT::IsImplicitMTEnabled()) { case ELoopType::kNoFilesMT: RunEmptySourceMT(); break;
switch (fLoopType) { case ELoopType::kROOTFilesMT: RunTreeProcessorMT(); break;
case ELoopType::kNoFiles: RunEmptySourceMT(); break; case ELoopType::kDataSourceMT: RunDataSourceMT(); break;
case ELoopType::kROOTFiles: RunTreeProcessorMT(); break; case ELoopType::kNoFiles: RunEmptySource(); break;
case ELoopType::kDataSource: RunDataSourceMT(); break; case ELoopType::kROOTFiles: RunTreeReader(); break;
} case ELoopType::kDataSource: RunDataSource(); break;
} else {
#endif // R__USE_IMT
switch (fLoopType) {
case ELoopType::kNoFiles: RunEmptySource(); break;
case ELoopType::kROOTFiles: RunTreeReader(); break;
case ELoopType::kDataSource: RunDataSource(); break;
}
#ifdef R__USE_IMT
} }
#endif // R__USE_IMT
CleanUpNodes(); CleanUpNodes();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment