oneapi-src / oneapi-src/oneAPI-samples
How to `parallel_reduce` a C++ map key or value?
Open
Nobody has claimed this yet.
question
- Dominant language
- C++
- Stars
- 1.2k
- Forks
- 745
- PR merge metrics
- No merged PRs in 30d
Description
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>>());
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the C++ example in the issue and determine what parallel_reduce operation is intended for the map's keys or values. A useful outcome would explain the correct reduction form for the shown counts map and clarify the required result and combining types.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- developer-experience
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100