Skip to content

Commit 2e63e13

Browse files
committed
Remove task group
1 parent 52a07cc commit 2e63e13

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

Framework/DataHandling/src/AlignAndFocusPowderSlim/ProcessBankTask.cpp

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,8 @@ void ProcessBankTask::operator()(const tbb::blocked_range<size_t> &range) const
9797

9898
// std::atomic allows for multi-threaded accumulation and who cares about floats when you are just
9999
// counting things
100-
std::vector<std::atomic_uint32_t> y_temp(spectrum.dataY().size());
101-
// std::vector<uint32_t> y_temp(spectrum.dataY().size());
102-
103-
// task group allows for separate of disk read from processing
104-
tbb::task_group_context tgroupcontext; // needed by parallel_reduce
105-
tbb::task_group tgroup(tgroupcontext);
100+
// std::vector<std::atomic_uint32_t> y_temp(spectrum.dataY().size())
101+
std::vector<uint32_t> y_temp(spectrum.dataY().size());
106102

107103
// create object so bank calibration can be re-used
108104
std::unique_ptr<BankCalibration> calibration = nullptr;
@@ -187,16 +183,12 @@ void ProcessBankTask::operator()(const tbb::blocked_range<size_t> &range) const
187183

188184
// Non-blocking processing of the events
189185
const tbb::blocked_range<size_t> range_info(0, event_time_of_flight->size(), m_grainsize_event);
190-
tbb::parallel_reduce(range_info, task, tgroupcontext);
186+
tbb::parallel_reduce(range_info, task);
191187

192-
// Atomically accumulate results into shared y_temp to combine local histograms
193-
for (size_t i = 0; i < y_temp.size(); ++i) {
194-
y_temp[i].fetch_add(task.y_temp[i], std::memory_order_relaxed);
195-
}
188+
// Accumulate results into shared y_temp to combine local histograms
189+
std::transform(y_temp.begin(), y_temp.end(), task.y_temp.begin(), y_temp.begin(), std::plus<uint32_t>());
196190
}
197191

198-
tgroup.wait();
199-
200192
// copy the data out into the correct spectrum
201193
auto &y_values = spectrum.dataY();
202194
std::copy(y_temp.cbegin(), y_temp.cend(), y_values.begin());

0 commit comments

Comments
 (0)