mpi - MPI_Rsend:how to know that a receive buffer is already posted -


by mpi_rsend man papers,in order use mpi_rsend,we need guarantee receive posted. error if receive not posted before ready send called.but how guarantee receive posted ???.i try find examples mpi_rsend,but can not find anything.and how error ?
in link mpi_rsend_error ,finally 1 said : "simply not use mpi_rsend - archaism, behaviour not well-defined, , made obsolete of protocol optimisations in modern mpi libraries".so,which mpi libraries implement rsend ? in fact,using mpi_rsend give better performance mpi_send in algorithms.
example code:

void allgather_ring_rsend(void* data, int count, mpi_datatype datatype,mpi_comm communicator)   {    int me;     mpi_comm_rank(communicator, &me);     int world_size;     mpi_comm_size(communicator, &world_size);    int next=me+1;    if(next>=world_size)        next=0;    int prev=me-1;    if(prev<0)        prev=world_size-1;    int i,curi=me;    for(i=0;i<world_size-1;i++)    {       mpi_rsend(data+curi*sizeof(int), count, datatype, next, 0, communicator);       curi=curi-1;       if(curi<0)           curi=world_size-1;       mpi_recv(data+curi*sizeof(int), count, datatype, prev, 0, communicator, mpi_status_ignore);         }  }  void main(int argc, char** argv) {      char processor_name[mpi_max_processor_name];      mpi_init(&argc,&argv);       int world_rank,world_size,namelen;       mpi_comm_size(mpi_comm_world, &world_size);      mpi_comm_rank(mpi_comm_world, &world_rank);      int* buff=(int*) malloc(world_size*sizeof(int));        int i;        (i = 0; < world_size; i++) {            buff[i]=world_rank;        }        if(world_rank==0)        (i = 0; < world_size; i++)            printf("%d\n",buff[i]);      mpi_barrier(mpi_comm_world);       allgather_ring_rsend(buff,1,mpi_int,mpi_comm_world);      mpi_barrier(mpi_comm_world);      mpi_finalize();     }

in code,is receive process posted???

mpi provides no built-in mechanism check whether remote rank has posted receive operation or not. program's logic ensure case e.g. having receiver notify somehow sender (e.g. via message or via completion of synchronisation call mpi_(i)barrier) has posted receive , therefore safe initiate ready-mode send.

as have said, ready-mode send obsoleted way modern networks , mpi implementations work. small messages sent asynchronously (using eager send protocol) while latency savings larger messages, if any, platform- & network- & implementation-dependent. the outcome of incorrectly used ready-mode send not defined in mpi standard , implementations allowed substitute standard mode ready one. therefore way easy trapped local implementation's behaviour of ready send , end incorrect mpi code. moreover, cannot write code reliably produce error on mpi implementations.

an example of mpi library implements ready mode standard mode open mpi. mpich implements ready mode eager messages checking matching receive upon message reception , returning error if none found, not provide performance benefit on standard send posted receive (may mpich guys correct me if i'm wrong).


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -