|
@@ -33,7 +33,7 @@ static struct _starpu_mpi_req_list detached_ft_service_requests;
|
|
|
static unsigned detached_send_n_ft_service_requests;
|
|
|
static starpu_pthread_mutex_t detached_ft_service_requests_mutex;
|
|
|
|
|
|
-int _ft_service_msg_recv_send_common(void* msg, int count, int rank, int tag, int req_type, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
+int _ft_service_msg_recv_send_common(void* ptr, int count, int rank, int tag, int req_type, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
{
|
|
|
struct _starpu_mpi_req* req;
|
|
|
|
|
@@ -52,19 +52,20 @@ int _ft_service_msg_recv_send_common(void* msg, int count, int rank, int tag, in
|
|
|
req->node_tag.data_tag = tag;
|
|
|
req->node_tag.node.comm = comm;
|
|
|
req->detached = 1;
|
|
|
- req->ptr = msg;
|
|
|
+ req->ptr = ptr;
|
|
|
req->sync = 0;
|
|
|
req->datatype = MPI_BYTE;
|
|
|
req->callback = callback;
|
|
|
req->callback_arg = arg;
|
|
|
req->func = NULL;
|
|
|
req->sequential_consistency = 1;
|
|
|
- req->count = sizeof(struct _starpu_mpi_cp_ack_msg);
|
|
|
+ req->count = count;
|
|
|
|
|
|
_mpi_backend._starpu_mpi_backend_request_fill(req, comm, 0);
|
|
|
|
|
|
STARPU_PTHREAD_MUTEX_LOCK(&detached_ft_service_requests_mutex);
|
|
|
if (req_type==SEND_REQ) {
|
|
|
+ fprintf(stderr, "data:%d/%d", *(int*)(req->ptr), *(int*)(req->ptr+4));
|
|
|
MPI_Isend(req->ptr, req->count, req->datatype, req->node_tag.node.rank, req->node_tag.data_tag,
|
|
|
req->node_tag.node.comm, &req->backend->data_request);
|
|
|
}
|
|
@@ -72,6 +73,9 @@ int _ft_service_msg_recv_send_common(void* msg, int count, int rank, int tag, in
|
|
|
MPI_Irecv(req->ptr, req->count, req->datatype, req->node_tag.node.rank, req->node_tag.data_tag,
|
|
|
req->node_tag.node.comm, &req->backend->data_request);
|
|
|
}
|
|
|
+ else {
|
|
|
+ STARPU_ASSERT_MSG(1, "Unrecognized req type: Only RECV_REQ and SEND_REQ are accepeted\n");
|
|
|
+ }
|
|
|
_starpu_mpi_req_list_push_back(&detached_ft_service_requests, req);
|
|
|
fprintf(stderr, "pushed service req: %p in list %p - prev: %p - next: %p - dest:%d - tag:%d\n", req, &detached_ft_service_requests, _starpu_mpi_req_list_prev(req), _starpu_mpi_req_list_next(req), req->node_tag.node.rank, (int)req->node_tag.data_tag);
|
|
|
if (req_type==SEND_REQ) {
|
|
@@ -82,19 +86,19 @@ int _ft_service_msg_recv_send_common(void* msg, int count, int rank, int tag, in
|
|
|
STARPU_PTHREAD_MUTEX_UNLOCK(&detached_ft_service_requests_mutex);
|
|
|
|
|
|
_starpu_mpi_wake_up_progress_thread();
|
|
|
-}
|
|
|
-
|
|
|
-inline int _ft_service_msg_isend_cb(void* msg, int count, int rank, int tag, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
-{
|
|
|
|
|
|
- return _ft_service_msg_recv_send_common(msg, count, rank, tag, SEND_REQ, comm, callback, arg);
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
-int _ft_service_msg_irecv_cb(void* msg, int count, int rank, int tag, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
-{
|
|
|
-
|
|
|
- return _ft_service_msg_recv_send_common(msg, count, rank, tag, SEND_REQ, comm, callback, arg);
|
|
|
-}
|
|
|
+//inline int _ft_service_msg_isend_cb(void* msg, int count, int rank, int tag, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
+//{
|
|
|
+// return _ft_service_msg_recv_send_common(msg, count, rank, tag, SEND_REQ, comm, callback, arg);
|
|
|
+//}
|
|
|
+//
|
|
|
+//inline int _ft_service_msg_irecv_cb(void* msg, int count, int rank, int tag, MPI_Comm comm, void (*callback)(void *), void* arg)
|
|
|
+//{
|
|
|
+// return _ft_service_msg_recv_send_common(msg, count, rank, tag, SEND_REQ, comm, callback, arg);
|
|
|
+//}
|
|
|
|
|
|
static void _starpu_mpi_handle_ft_request_termination(struct _starpu_mpi_req *req)
|
|
|
{
|
|
@@ -121,8 +125,6 @@ static void _starpu_mpi_handle_ft_request_termination(struct _starpu_mpi_req *re
|
|
|
// has completed, as MPI can re-order messages, let's call
|
|
|
// MPI_Wait to make sure data have been sent
|
|
|
int ret;
|
|
|
- ret = MPI_Wait(&req->backend->size_req, MPI_STATUS_IGNORE);
|
|
|
- STARPU_MPI_ASSERT_MSG(ret == MPI_SUCCESS, "MPI_Wait returning %s", _starpu_mpi_get_mpi_error_code(ret));
|
|
|
starpu_free_on_node_flags(STARPU_MAIN_RAM, (uintptr_t)req->ptr, req->count, 0);
|
|
|
req->ptr = NULL;
|
|
|
}
|
|
@@ -201,7 +203,7 @@ void starpu_mpi_test_ft_detached_service_requests(void)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- fprintf(stderr, "req success: %d\n", detached_send_n_ft_service_requests);
|
|
|
+ fprintf(stderr, "req success: %p\n", req);
|
|
|
_STARPU_MPI_TRACE_POLLING_END();
|
|
|
struct _starpu_mpi_req *next_req;
|
|
|
next_req = _starpu_mpi_req_list_next(req);
|