Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to parallel_reduce a C++ map key or value? #2399

Open
khteh opened this issue Jul 25, 2024 · 0 comments
Open

How to parallel_reduce a C++ map key or value? #2399

khteh opened this issue Jul 25, 2024 · 0 comments
Labels
question Further information is requested

Comments

@khteh
Copy link

khteh commented Jul 25, 2024

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 khteh added the question Further information is requested label Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant