-
Notifications
You must be signed in to change notification settings - Fork 1.5k
[RF] IMT parallel for in the computation library #7874
Copy link
Copy link
Closed
Description
Is your feature request related to a problem? Please describe.
The problem is only speed. :-)
Describe the solution you'd like
Use TExecutor to parallelise for loops in RooFit. Currently, you have to use something like
void runParallel() {
ROOT::Internal::TExecutor ex;
constexpr std::size_t nTotal = 101;
const auto nChunk = ROOT::IsImplicitMTEnabled() ? ex.GetPoolSize() : 1u;
auto printRange = [=](std::size_t i) {
const auto nEvent = nTotal / nChunk + (nTotal%nChunk != 0);
const auto begin = nEvent * i;
const auto end = std::min( nEvent * (i+1), nTotal);
std::cout << "[" << i << "] does " << begin << "\t" << end << std::endl; sleep(1);
// <Do the computation work here>
// We are forced to return a dummy value with `TExecutor::Map()`
return 0;
};
ex.Map(printRange, ROOT::TSeq<std::size_t>(0, nChunk));
}Alternatively, one can fill a vector with something like pair<size_t, size_t>(begin, end), and run this in parallel using TExecutor.
Describe alternatives you've considered
Reactions are currently unavailable