MPI_Allreduce 源
我正在编写涉及 for 循环的代码,该循环在每个索引处进行计算。
这些计算中的最小值存储在变量中,我在程序末尾使用 MPI_Allreduce 来确定所有进程的全局最小值。
但是,我需要一种方法来知道哪个进程具有最小值,即 MPI_Allreduce 可以告诉我哪个进程发送结果吗?值最小的过程?我需要从该过程中获取一些额外的数据。
预先感谢您的任何帮助!
I am writing code that involved a for loop that makes calculations at each index.
The smallest of these calculations is stored in a variable and I use MPI_Allreduce at the end of the program to determine the global minimum across all processes.
However, I need a way of knowing which process has the smallest value, i.e. can MPI_Allreduce tell me which process sends the result? the process with the smallest value? there is some additional data I need to get from that process.
Thanks in advance for any help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在reduce 操作中使用
MPI_MINLOC
运算符来接收具有最小值的进程的排名(更具体地说,是具有最小值的排名最低的进程)。请参阅http://www.netlib.org/utk/papers/ mpi-book/node114.html#SECTION005103000000000000000
You can use the
MPI_MINLOC
operator in the reduce operation to receive the rank of the process with the minimal value (more specifically, the lowest ranked process that has a minimal value).See http://www.netlib.org/utk/papers/mpi-book/node114.html#SECTION005103000000000000000