oneapi-src / oneapi-src/oneAPI-samples

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

未关闭
#2,399 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

question
主要语言
C++
星标
1.2k
派生
745
PR 合并指标
30 天内没有已合并 PR

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 issue 中的 C++ 示例开始,确定针对 map 的键或值 intended 使用哪种 parallel_reduce 操作。一个有用的结果应说明所示 counts map 的正确 reduction 形式,并明确所需的结果类型和组合类型。

由索引模型根据 Issue 内容生成。

评估

技术栈
cpp
领域
developer-experience
Issue 类型
文档
难度
5/5
预计耗时
一周以上
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。