知识卡片
并行循环可用二分派生实现
parallel for允许各迭代同时执行;
运行时可递归将迭代区间二分,一半spawn、另一半本地计算,最后sync。满二叉派生树的内部节点只带来常数倍工作开销。
这张卡片看不懂?
这张卡片的反馈已满 10 条,暂时无法继续提交。
已有反馈 · 0 / 10 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- 第26章 并行算法 · 查看原书依据
Compilers for fork-join parallel programs can implement parallel for loops in terms of spawn and sync by using recursive spawning. For example, for the parallel for loop in lines 1–3, a compiler can generate the
参考来源
- 位置:《算法导论(第4版)》第26章《并行算法》(OEBPS/chapter026.xhtml,文本字符[35000,40000))。
- 结论依据:原文给出递归派生伪代码及工作开销分析。
- 原始内容:Compilers for fork-join parallel programs can implement parallel for loops in terms of spawn and sync by using recursive spawning. For example, for the parallel for loop in lines 1–3, a compiler can generate the