Commit 20da736e by 10382

📙 2nd Homework First Part

parent 48fc8d8f
# 并行规约求和算法
## 什么是规约
> A reduction operator can help break down a task into various partial tasks by calculating partial results which can be used to obtain a final result. ...... A reduction operator stores the result of the partial tasks into a private copy of the variable. These private copies are then merged into a shared copy at the end.
一个规约操作可以通过计算可用于计算最终结果的子结果来帮助一个任务划分为多个子任务。...... 一个规约操作将子任务的结果存储到到一个变量的私有拷贝,这些私有拷贝最终被合并到一个共享拷贝。
也就是说,规约做了两个事情:
1. 任务划分:将大任务划分为子任务
2. 任务结果合并:将子任务的结果合并后返回
🤔 Map 和 Reduce 是不是就是这样的思想?
## 为什么要规约
> It allows certain serial operations to be performed in parallel and the number of steps required for those operations to be reduced.
它允许特定的串行操作以并行的方式执行且能降低所需的操作数。
总结为以下两个优点:
1. 可并行化:将原有的串行操作转变为并行操作,减少运行时间。
2. 减少运算次数:通过类似归并的操作降低运算次数,减少时间复杂度。
## 具体实现
### OpenMP
未完待续......
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment