Skip to content
Snippets Groups Projects
Commit d1cda8b4 authored by Danilo Piparo's avatar Danilo Piparo
Browse files

[TTreeProcessorMT] Remove protections to cope with task interleaving

parent 26421c3c
No related branches found
No related tags found
No related merge requests found
...@@ -71,7 +71,6 @@ namespace ROOT { ...@@ -71,7 +71,6 @@ namespace ROOT {
// NOTE: fFriends must come before fChain to be deleted after it, see ROOT-9281 for more details // NOTE: fFriends must come before fChain to be deleted after it, see ROOT-9281 for more details
std::vector<std::unique_ptr<TChain>> fFriends; ///< Friends of the tree/chain std::vector<std::unique_ptr<TChain>> fFriends; ///< Friends of the tree/chain
std::unique_ptr<TChain> fChain; ///< Chain on which to operate std::unique_ptr<TChain> fChain; ///< Chain on which to operate
std::vector<Long64_t> fLoadedEntries; ///<! Per-task loaded entries (for task interleaving)
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// Construct fChain, also adding friends if needed and injecting knowledge of offsets if available. /// Construct fChain, also adding friends if needed and injecting knowledge of offsets if available.
...@@ -161,20 +160,6 @@ namespace ROOT { ...@@ -161,20 +160,6 @@ namespace ROOT {
// we need to return the entry list too, as it needs to be in scope as long as the reader is // we need to return the entry list too, as it needs to be in scope as long as the reader is
return std::make_pair(std::move(reader), std::move(localList)); return std::make_pair(std::move(reader), std::move(localList));
} }
//////////////////////////////////////////////////////////////////////////
/// Push a new loaded entry to the stack.
void PushTaskFirstEntry(Long64_t entry) { fLoadedEntries.push_back(entry); }
//////////////////////////////////////////////////////////////////////////
/// Restore the tree of the previous loaded entry, if any.
void PopTaskFirstEntry()
{
fLoadedEntries.pop_back();
if (fLoadedEntries.size() > 0) {
fChain->LoadTree(fLoadedEntries.back());
}
}
}; };
} // End of namespace Internal } // End of namespace Internal
......
...@@ -335,17 +335,11 @@ void TTreeProcessorMT::Process(std::function<void(TTreeReader &)> func) ...@@ -335,17 +335,11 @@ void TTreeProcessorMT::Process(std::function<void(TTreeReader &)> func)
shouldUseGlobalEntries ? entries : std::vector<Long64_t>({theseClustersAndEntries.second[0]}); shouldUseGlobalEntries ? entries : std::vector<Long64_t>({theseClustersAndEntries.second[0]});
auto processCluster = [&](const Internal::EntryCluster &c) { auto processCluster = [&](const Internal::EntryCluster &c) {
// This task will operate with the tree that contains start
treeView->PushTaskFirstEntry(c.start);
std::unique_ptr<TTreeReader> reader; std::unique_ptr<TTreeReader> reader;
std::unique_ptr<TEntryList> elist; std::unique_ptr<TEntryList> elist;
std::tie(reader, elist) = treeView->GetTreeReader(c.start, c.end, fTreeName, theseFiles, fFriendInfo, std::tie(reader, elist) = treeView->GetTreeReader(c.start, c.end, fTreeName, theseFiles, fFriendInfo,
fEntryList, theseEntries, friendEntries); fEntryList, theseEntries, friendEntries);
func(*reader); func(*reader);
// In case of task interleaving, we need to load here the tree of the parent task
treeView->PopTaskFirstEntry();
}; };
pool.Foreach(processCluster, thisFileClusters); pool.Foreach(processCluster, thisFileClusters);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment