知识卡片
临时矩阵隔离并行乘积写入
递归矩阵乘法的八个子乘积可并发计算,但同一结果子矩阵的两项不能并发累加。
先将其中四项写入临时矩阵,汇合后再相加,便以额外空间换取无写入竞争的并行。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第26章 并行算法 · 查看原书依据
To avoid determinacy races in updating the elements of C, it creates a temporary matrix D to store four of the submatrix products. At the end, it adds C and D together to produce the final result.
参考来源
- 位置:《算法导论(第4版)》第26章《并行算法》(OEBPS/chapter026.xhtml,文本字符[55000,60000))。
- 结论依据:第26章 P-MATRIX-MULTIPLY-RECURSIVE 第9–16行:四个子乘积写 C,另四个写临时矩阵 D;第17行 sync 后第18–20行并行逐元素相加,避免对 C 的并发更新。
- 原始内容:To avoid determinacy races in updating the elements of C , it creates a temporary matrix D to store four of the submatrix products. At the end, it adds C and D together to produce the final result.