如何写自己的 MPI_Bcast 和 MPI_reduce

How to write own MPI_Bcast and MPI_reduce

是否可以编写自己的 Mpi_BcastMpi_reduce 并像 MyMpi_BcastMyMpi_Reduce 那样调用它? 并且具有与真正的 Mpi_Bcast and Reduce.

相同的参数

1.int myMPI_Bcast( void *buffer, int count, MPI_Datatype datatype,int root, MPI_Comm comm);

2.int myMPI_Reduce( const void *sendbuf, void *recvbuf, int count,int root, MPI_Comm comm);

我的目的是比较真实的 Mpi_Bcast 和自己的实现?例如:

-— int test —-
My_MPI_Bcast: 50ms
MPI_Bcast: 34ms

说实话,自己的mpi_communicators的实现我也找了一些资料,没找到例子。你能帮忙吗?

This tutorial does exactly that.

链接的教程更有帮助,但最简单的 bcast 基本上只是将原始进程发送到所有其他进程。

对于最简单的 reduce 将所有进程发送到一个进程,接收方以指定的任何方法组合输入。