MPI_Allreduce 源

发布于 2025-01-07 06:04:06 字数 209 浏览 1 评论 0原文

我正在编写涉及 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甜中书 2025-01-14 06:04:06

您可以在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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文