且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

MPI_Reduce 和 MPI_MIN 如何工作?

更新时间:2023-11-10 16:08:10

MPI_Reduce 对通信器的成员执行归约 - 而不是本地数组的成员.sendbufrecvbuf 必须具有相同的 size.

MPI_Reduce performs a reduction over the members of the communicator - not the members of the local array. sendbuf and recvbuf must both be of the same size.

我认为标准说得***:

因此,所有进程都提供相同长度的输入缓冲区和输出缓冲区,具有相同类型的元素.每个进程可以提供一个元素或元素序列,在这种情况下,组合操作在序列的每个条目上按元素执行.

Thus, all processes provide input buffers and output buffers of the same length, with elements of the same type. Each process can provide one element, or a sequence of elements, in which case the combine operation is executed element-wise on each entry of the sequence.

MPI 不会获取数组中所有元素的最小值,您必须手动获取.

MPI does not get the minimum of all elements in the array, you have to do that manually.