Skip to content

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

Open
@khteh

Description

@khteh

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>>());

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions