oneAPI-samples icon indicating copy to clipboard operation
oneAPI-samples copied to clipboard

How to `parallel_reduce` a C++ map key or value?

Open khteh opened this issue 1 year ago • 1 comments

I don't find it from google. How can I parallel_reduce either the key or value of a map? For example:

       map<T, size_t> counts;
	size_t count = parallel_reduce(
		blocked_range<pair<T, size_t>>(0, counts.size()), 0,
		[&](tbb::blocked_range<pair<T, size_t>> const &r, size_t running_total)
		{
			for (auto it = r.begin(); it != r.end(); it++)
				running_total += it->second;
			return running_total;
		},
		std::plus<pair<T, size_t>>());

khteh avatar Jul 25 '24 09:07 khteh

@khteh For oneTBB questions please use https://github.com/uxlfoundation/oneTBB/issues

omalyshe avatar May 14 '25 13:05 omalyshe