-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Support a blocked range in TExecutor? #7873
Copy link
Copy link
Closed as not planned
Labels
1st Hackathon: the FixhathonThis issue can be tackled at a ROOT fixathonThis issue can be tackled at a ROOT fixathonnew feature
Description
Is your feature request related to a problem? Please describe.
Not a problem, just ease of use when processing e.g. a large array with a lot of entries in parallel (with using SIMD in each thread).
Describe the solution you'd like
ROOT
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);
// We are forced to return a dummy value
return 0;
};
ex.Map(printRange, ROOT::TSeq<std::size_t>(0, nChunk));
}TBB
void runParallel() {
constexpr std::size_t nTotal = 101;
auto printRange = [](const tbb::blocked_range<std::size_t>& range) {
std::cout << "Doing " << range.begin() << "\t" << range.end() << std::endl; sleep(1);
};
tbb::parallel_for(tbb::blocked_range<std::size_t>(0, nTotal), printRange, tbb::static_partitioner());
}OMP
+ #pragma omp parallel for schedule(static)
for (std::size_t i = 0; i < end; ++i) {Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
1st Hackathon: the FixhathonThis issue can be tackled at a ROOT fixathonThis issue can be tackled at a ROOT fixathonnew feature
Type
Projects
Status
Done