c++ - MPI multiple send and receive in loop -
i have big problem code , maybe conceptually. need work done in 2 different functions. 1 function has 1 instance , main thread, , second function has many instances on many other nodes.
one of functions (function a) sending 3 parts of data nodes, , other function, b, should receive @ each node. next, function should wait results. when ready functions b in each of nodes should send 1 part of data function a, , starts again.
it should work in sample code:
void preparedata() { //function for(int = 1 ; < threads;i++) { mpi_send(...); //first part of data mpi_send(...); //second part of data mpi_send(...); //third part of dat } //here function (a) should wait because second function (b) computing data for(int i=1;i<threads;i++) { mpi_recv(...); //receiving data function b } } void computedata() { //function b while(isdone) { mpi_recv(...); //first part of data mpi_recv(...); //second part of data mpi_recv(...); //third part of data //here data computed , sending main function mpi_send(...); //sending data function } }
does know how , mpi function should use , how?
well, happens when try approach describe?
are using threads here or conflating threaded programming message passing? idiomatic mpi more like
for(int = 1 ; < nprocs;i++) { ... }
send might block, should use isend , test/wait completion.
Comments
Post a Comment