|
@@ -131,17 +131,25 @@ void _starpu_mpi_common_mp_initialize_src_sink(struct _starpu_mp_node *node)
|
|
|
|
|
|
int _starpu_mpi_common_recv_is_ready(const struct _starpu_mp_node *mp_node)
|
|
|
{
|
|
|
- int res, tag;
|
|
|
+ int res, tag, source;
|
|
|
int flag = 0;
|
|
|
int id_proc;
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &id_proc);
|
|
|
|
|
|
if (id_proc == src_node_id)
|
|
|
+ {
|
|
|
+ /* Source has mp_node defined */
|
|
|
tag = mp_node->mp_connection.mpi_remote_nodeid;
|
|
|
+ source = mp_node->mp_connection.mpi_remote_nodeid;
|
|
|
+ }
|
|
|
else
|
|
|
- tag = id_proc;
|
|
|
-
|
|
|
- res = MPI_Iprobe(MPI_ANY_SOURCE, tag, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE);
|
|
|
+ {
|
|
|
+ /* Sink can have sink to sink message */
|
|
|
+ tag = MPI_ANY_TAG;
|
|
|
+ source = MPI_ANY_SOURCE;
|
|
|
+ }
|
|
|
+
|
|
|
+ res = MPI_Iprobe(source, tag, MPI_COMM_WORLD, &flag, MPI_STATUS_IGNORE);
|
|
|
STARPU_ASSERT_MSG(res == MPI_SUCCESS, "MPI Master/Slave cannot test if we received a message !");
|
|
|
|
|
|
return flag;
|
|
@@ -150,7 +158,6 @@ int _starpu_mpi_common_recv_is_ready(const struct _starpu_mp_node *mp_node)
|
|
|
/* SEND to source node */
|
|
|
void _starpu_mpi_common_send(const struct _starpu_mp_node *node, void *msg, int len)
|
|
|
{
|
|
|
- printf("envoi %d B to %d \n", len, node->mp_connection.mpi_remote_nodeid);
|
|
|
int res, tag;
|
|
|
int id_proc;
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &id_proc);
|
|
@@ -160,6 +167,8 @@ void _starpu_mpi_common_send(const struct _starpu_mp_node *node, void *msg, int
|
|
|
else
|
|
|
tag = id_proc;
|
|
|
|
|
|
+ printf("envoi %d B to %d et tag %d\n", len, node->mp_connection.mpi_remote_nodeid, tag);
|
|
|
+
|
|
|
res = MPI_Send(msg, len, MPI_BYTE, node->mp_connection.mpi_remote_nodeid, tag, MPI_COMM_WORLD);
|
|
|
STARPU_ASSERT_MSG(res == MPI_SUCCESS, "MPI Master/Slave cannot receive a msg with a size of %d Bytes !", len);
|
|
|
}
|
|
@@ -167,9 +176,9 @@ void _starpu_mpi_common_send(const struct _starpu_mp_node *node, void *msg, int
|
|
|
/* RECV to source node */
|
|
|
void _starpu_mpi_common_recv(const struct _starpu_mp_node *node, void *msg, int len)
|
|
|
{
|
|
|
- printf("recv %d B from %d \n", len, node->mp_connection.mpi_remote_nodeid);
|
|
|
int res, tag;
|
|
|
int id_proc;
|
|
|
+ MPI_Status s;
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &id_proc);
|
|
|
|
|
|
if (id_proc == src_node_id)
|
|
@@ -177,7 +186,13 @@ void _starpu_mpi_common_recv(const struct _starpu_mp_node *node, void *msg, int
|
|
|
else
|
|
|
tag = id_proc;
|
|
|
|
|
|
- res = MPI_Recv(msg, len, MPI_BYTE, node->mp_connection.mpi_remote_nodeid, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
+ printf("recv %d B from %d in %p et tag %d\n", len, node->mp_connection.mpi_remote_nodeid, msg, tag);
|
|
|
+
|
|
|
+ res = MPI_Recv(msg, len, MPI_BYTE, node->mp_connection.mpi_remote_nodeid, tag, MPI_COMM_WORLD, &s);
|
|
|
+ int num_expected;
|
|
|
+ MPI_Get_count(&s, MPI_BYTE, &num_expected);
|
|
|
+
|
|
|
+ STARPU_ASSERT_MSG(num_expected == len, "MPI Master/Slave received a msg with a size of %d Bytes (expected %d Bytes) !", num_expected, len);
|
|
|
STARPU_ASSERT_MSG(res == MPI_SUCCESS, "MPI Master/Slave cannot receive a msg with a size of %d Bytes !", len);
|
|
|
}
|
|
|
|
|
@@ -188,10 +203,8 @@ void _starpu_mpi_common_send_to_device(const struct _starpu_mp_node *node, int d
|
|
|
int id_proc;
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &id_proc);
|
|
|
|
|
|
- if (id_proc == src_node_id)
|
|
|
- tag = node->mp_connection.mpi_remote_nodeid;
|
|
|
- else
|
|
|
- tag = id_proc;
|
|
|
+ tag = dst_devid;
|
|
|
+ printf("send %d bytes from %d from %p et tag %d\n", len, dst_devid, msg, tag);
|
|
|
|
|
|
res = MPI_Send(msg, len, MPI_BYTE, dst_devid, tag, MPI_COMM_WORLD);
|
|
|
STARPU_ASSERT_MSG(res == MPI_SUCCESS, "MPI Master/Slave cannot receive a msg with a size of %d Bytes !", len);
|
|
@@ -204,10 +217,8 @@ void _starpu_mpi_common_recv_from_device(const struct _starpu_mp_node *node, int
|
|
|
int id_proc;
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD, &id_proc);
|
|
|
|
|
|
- if (id_proc == src_node_id)
|
|
|
- tag = node->mp_connection.mpi_remote_nodeid;
|
|
|
- else
|
|
|
- tag = id_proc;
|
|
|
+ tag = src_devid;
|
|
|
+ printf("nop recv %d bytes from %d et tag %d\n", len, src_devid, tag);
|
|
|
|
|
|
res = MPI_Recv(msg, len, MPI_BYTE, src_devid, tag, MPI_COMM_WORLD, MPI_STATUS_IGNORE);
|
|
|
STARPU_ASSERT_MSG(res == MPI_SUCCESS, "MPI Master/Slave cannot receive a msg with a size of %d Bytes !", len);
|
|
@@ -321,6 +332,5 @@ void _starpu_mpi_common_measure_bandwidth_latency(double * bandwidth_htod, doubl
|
|
|
|
|
|
id++;
|
|
|
}
|
|
|
-
|
|
|
free(buf);
|
|
|
}
|