c - MPI_Recv: Receiving a different size than the one Sent -
i writing program check shortest path using mpi
library. there 2 scenarios:
either found better path, in case first slot of buffer state resultbuff[0] = 1
, need go on rest of contents of buffer better path.
other case resultbuff[0] = 0
, , won't excpect values in other cells of buffer.
is possible me use separate mpi_isend
calls:
in case found better path , stored in resultbuff[1]
resultbuff[10]
:
mpi_isend((void*)sendbuff, 11, mpi_int, 0, 1, mpi_comm_world, &request);
in case didn't found better path:
mpi_isend((void*)sendbuff, 1, mpi_int, 0, 1, mpi_comm_world, &request);
and in both cases i'll use
mpi_recv( (void*)resultbuff, 11, mpi_int, mpi_any_source, 1, mpi_comm_world, &status);
to receive result.
will work?
if does, save communication costs if don't send better path?
note: resultbuff
of size 11.
yes, can this. mpi standard , man pages mpi_recv, "the count argument indicates maximum length of message; actual number can determined mpi_get_count" call using status
object got mpi_recv().
as saving communication costs, won't -- such short messages dominated latency of sending message rather bandwidth.
Comments
Post a Comment