c - MPI reverse probe -
is there way check if processes waiting on mpi_recv?
i have root proc, , slave processes.
slave psedo-code:
while (1) { do_some_stuff; // calls mpi_test , clear unused buffers mpi_recv(buf, ...); do_something_with_buf; mpi_isend(buf2, ...); // possibly many sends depending on in buf }
if slave processes hang on mpi_recv, job done , need brake loop. need way notify slave processes job done. there way this? thought there might reverse probe check if waits message instead of checking if there message recieve. haven't found useful tho.
edit: more explanation.
i have 1 root proc, reads huge file , sends read data workers(rest of processes). each worker recieves portion of data, distributed(each worker has same amount of data stored). workers start communicate each other sending partial computations. when worker recieves partial computation may produce lot of new partial results, of need sent other workes. work done when workers have nothing , there no more partial results waiting recieved.
you should able avoid situation there receive expected nothing sent. sending processor, in master slave type situations, should keeping track of how work there send. typically master slave strategy work master keeping track , killing off slaves once total reached...
in terms of functions, closest equivalent probe on send side may use non-blocking send mpi_isend
, returns status
can passed mpi_test
, non-blocking , return mpi_success
message has been received successfully. can use mpi_wait
status if want block sending code until message has been received. using test/wait unique tags each send each processes way perform want.
Comments
Post a Comment