MPI程序使用MPI_Scatter和MPI_Reduce
编写一个有效计算数组元素总和的MPI程序。 程序1:任务与MPI_Scatter和MPI_Reduce通信。
- 程序可以假定过程数量是两个的幂。
- 程序应在范围0到100中添加2^15 = 65536随机双打。 任务0必须生成数字,将它们存储在数组中并将其分配到任务。
- 每个任务都执行分配的数字的串行总和。当地总和是 使用树结构化并行总和一起添加。
- 并行总和完成后,任务0应计算一个串行总和 相同的数字(验证结果)。
- 任务0必须打印并行总和,串行和 并行总和(包括数据分布)。
Write an MPI program that efficiently compute the sum of array elements.
Program 1: Tasks communicate with MPI_Scatter and MPI_Reduce.
- The programs can assume that the number of processes is a power of two.
- The programs should add 2^15 = 65536 random doubles in the range 0 to 100.
Task 0 must generate the numbers, store them in array and distribute them to the tasks. - Each task does a serial sum of the numbers it is assigned. The local sums are then
added together using a tree structured parallel sum. - After the parallel sum is complete, task 0 should compute a serial sum of the
same numbers (to verify the result). - Task 0 must print the parallel sum, the serial sum and the time required for the
parallel sum (including data distribution).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
}
}