简体   繁体   中英

How to write own MPI_Bcast and MPI_reduce

Is it possible to write own Mpi_Bcast and Mpi_reduce called it like MyMpi_Bcast and MyMpi_Reduce ? And have the same arguments like it has the real 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);

My purpose is comparing the real Mpi_Bcast and own implementation? For example:

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

Truthfully, I have searched some information for implementations of own mpi_communicators , and I can't find examples. Can you ,please, help?

This tutorial does exactly that.

The linked tutorial is much more helpful, but for simplest bcast basically just have the originiating process send to all other processes.

For the most simple reduce have all processes send to one and the reciever combines the input in whatever method is specified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM