Commit 3e005f03 authored by Min Si's avatar Min Si Committed by Xin Zhao
Browse files

Implement true request-based RMA operations.



There are two requests associated with each request-based
operation: one normal internal request (req) and one newly
added user request (ureq). We return ureq to user when
request-based op call returns.

The ureq is initialized with completion counter (CC) to 1
and ref count to 2 (one is referenced by CH3 and another
is referenced by user). If the corresponding op can be
finished immediately in CH3, the runtime will complete ureq
in CH3, and let user's MPI_Wait/Test to destroy ureq. If
corresponding op cannot be finished immediately, we will
first increment ref count to 3 (because now there are
three places needed to reference ureq: user, CH3,
progress engine). Progress engine will complete ureq when
op is completed, then CH3 will release its reference during
garbage collection, finally user's MPI_Wait/Test will
destroy ureq.

The ureq can be completed in following three ways:

1. If op is issued and completed immediately in CH3
(req is NULL), we just complete ureq before free op.

2. If op is issued but not completed, we remember the ureq
handler in req and specify OnDataAvail / OnFinal handlers
in req to a newly added request handler, which will complete
user reqeust. The handler is triggered at three places:
   2-a. when progress engine completes a put/acc req;
   2-b. when get/getacc handler completes a get/getacc req;
   2-c. when progress engine completes a get/getacc req;

3. If op is not issued (i.e., wait for lock granted), the 2nd
way will be eventually performed when such op is issued by
progress engine.
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
parent 73859c0e
......@@ -1613,12 +1613,12 @@ struct MPID_Win;
typedef struct MPID_RMA_Ops {
int (*Win_free)(struct MPID_Win **);
int (*Put)(const void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype,
struct MPID_Win *);
int (*Get)(void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype,
struct MPID_Win *);
int (*Accumulate)(const void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, MPI_Op, struct MPID_Win *);
int (*Put) (const void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, struct MPID_Win *, MPID_Request *);
int (*Get) (void *, int, MPI_Datatype, int, MPI_Aint, int, MPI_Datatype,
struct MPID_Win *, MPID_Request *);
int (*Accumulate) (const void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, MPI_Op, struct MPID_Win *, MPID_Request *);
int (*Win_fence)(int, struct MPID_Win *);
int (*Win_post)(MPID_Group *, int, struct MPID_Win *);
......@@ -1649,7 +1649,7 @@ typedef struct MPID_RMA_Ops {
int (*Get_accumulate)(const void *, int , MPI_Datatype, void *, int,
MPI_Datatype, int, MPI_Aint, int, MPI_Datatype, MPI_Op,
struct MPID_Win *);
struct MPID_Win *, MPID_Request *);
int (*Fetch_and_op)(const void *, void *, MPI_Datatype, int, MPI_Aint, MPI_Op,
struct MPID_Win *);
int (*Compare_and_swap)(const void *, const void *, void *, MPI_Datatype, int,
......
......@@ -148,7 +148,7 @@ int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
mpi_errno = MPIU_RMA_CALL(win_ptr,Accumulate(origin_addr, origin_count,
origin_datatype,
target_rank, target_disp, target_count,
target_datatype, op, win_ptr));
target_datatype, op, win_ptr, NULL));
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -142,7 +142,7 @@ int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype
mpi_errno = MPIU_RMA_CALL(win_ptr,
Get(origin_addr, origin_count, origin_datatype,
target_rank, target_disp, target_count,
target_datatype, win_ptr));
target_datatype, win_ptr, NULL));
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -198,7 +198,7 @@ int MPI_Get_accumulate(const void *origin_addr, int origin_count,
result_addr, result_count,
result_datatype,
target_rank, target_disp, target_count,
target_datatype, op, win_ptr));
target_datatype, op, win_ptr, NULL));
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -142,7 +142,7 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype
mpi_errno = MPIU_RMA_CALL(win_ptr,
Put(origin_addr, origin_count, origin_datatype,
target_rank, target_disp, target_count,
target_datatype, win_ptr));
target_datatype, win_ptr, NULL));
if (mpi_errno != MPI_SUCCESS) goto fn_fail;
/* ... end of body of routine ... */
......
......@@ -378,6 +378,15 @@ static inline int MPIDI_CH3I_RMA_Cleanup_ops_target(MPID_Win * win_ptr, MPIDI_RM
/* No errors, free the request */
MPID_Request_release(curr_op->request);
/* Release user request */
if (curr_op->ureq) {
/* User request must be completed by progress engine */
MPIU_Assert(MPID_Request_is_complete(curr_op->ureq));
/* Release the ch3 ref */
MPID_Request_release(curr_op->ureq);
}
/* dequeue the operation and free it */
MPL_LL_DELETE(*op_list, *op_list_tail, curr_op);
MPIDI_CH3I_Win_op_free(win_ptr, curr_op);
......
......@@ -82,6 +82,8 @@ typedef struct MPIDI_RMA_Op {
MPIDI_RMA_Pool_type_t pool_type;
int is_dt;
int piggyback_lock_candidate;
MPID_Request *ureq;
} MPIDI_RMA_Op_t;
typedef struct MPIDI_RMA_Target {
......
......@@ -1154,11 +1154,11 @@ int MPIDI_Win_create(void *, MPI_Aint, int, MPID_Info *, MPID_Comm *,
int MPIDI_Win_free(MPID_Win **);
int MPIDI_Put(const void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, MPID_Win *);
MPI_Datatype, MPID_Win *, MPID_Request * ureq);
int MPIDI_Get(void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, MPID_Win *);
MPI_Datatype, MPID_Win *, MPID_Request * ureq);
int MPIDI_Accumulate(const void *, int, MPI_Datatype, int, MPI_Aint, int,
MPI_Datatype, MPI_Op, MPID_Win *);
MPI_Datatype, MPI_Op, MPID_Win *, MPID_Request * ureq);
int MPIDI_Win_fence(int, MPID_Win *);
int MPIDI_Win_post(MPID_Group *group_ptr, int assert, MPID_Win *win_ptr);
......@@ -1187,7 +1187,8 @@ int MPIDI_Win_get_info(MPID_Win *win, MPID_Info **info_used);
int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPID_Win *win);
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPID_Win *win,
MPID_Request * ureq);
int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
MPI_Datatype datatype, int target_rank, MPI_Aint target_disp,
MPI_Op op, MPID_Win *win);
......@@ -1904,6 +1905,10 @@ int MPIDI_CH3_ReqHandler_GetSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
int MPIDI_CH3_ReqHandler_GaccumLikeSendComplete( MPIDI_VC_t *, MPID_Request *,
int * );
/* Request-based operation handler */
int MPIDI_CH3_ReqHandler_ReqOpsComplete(MPIDI_VC_t *, MPID_Request *,
int *);
/* Thread Support */
#ifdef MPICH_IS_THREADED
#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
......
......@@ -446,7 +446,8 @@ typedef struct MPIDI_Request {
/* For derived datatypes at target */
struct MPIDI_RMA_dtype_info *dtype_info;
void *dataloop;
/* req. handle needed to implement derived datatype gets */
/* req. handle needed to implement derived datatype gets.
* It also used for remembering user request of request-based RMA operations. */
MPI_Request request_handle;
MPI_Win target_win_handle;
MPI_Win source_win_handle;
......
......@@ -14,6 +14,7 @@ mpi_core_sources += \
src/mpid/ch3/src/ch3u_handle_recv_req.c \
src/mpid/ch3/src/ch3u_handle_revoke_pkt.c \
src/mpid/ch3/src/ch3u_handle_send_req.c \
src/mpid/ch3/src/ch3u_handle_op_req.c \
src/mpid/ch3/src/ch3u_port.c \
src/mpid/ch3/src/ch3u_recvq.c \
src/mpid/ch3/src/ch3u_request.c \
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2014 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpidimpl.h"
#include "mpidrma.h"
/* Note the the following function is called when request-based RMA operation
is completed at origin side. Here we complete the user request associated
with this request-based operation. */
#undef FUNCNAME
#define FUNCNAME MPIDI_CH3_ReqHandler_ReqOpsComplete
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_CH3_ReqHandler_ReqOpsComplete(MPIDI_VC_t * vc, MPID_Request * sreq, int *complete)
{
int mpi_errno = MPI_SUCCESS;
MPID_Request *ureq = NULL;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_REQOPSCOMPLETE);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3_REQHANDLER_REQOPSCOMPLETE);
MPID_Request_get_ptr(sreq->dev.request_handle, ureq);
MPIU_Assert(ureq != NULL);
/* Complete user request and release ref of completion handler.
* Note that ch3 ref is released by later clean_up call. */
MPID_Request_set_completed(ureq);
MPID_Request_release(ureq);
MPIDI_CH3U_Request_complete(sreq);
*complete = TRUE;
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_REQHANDLER_REQOPSCOMPLETE);
return mpi_errno;
fn_fail:
goto fn_exit;
}
......@@ -264,7 +264,10 @@ static inline int issue_ops_target(MPID_Win * win_ptr, MPIDI_RMA_Target_t *targe
goto fn_exit;
if (curr_op->next == NULL &&
target->sync.sync_flag == MPIDI_RMA_SYNC_NONE) {
target->sync.sync_flag == MPIDI_RMA_SYNC_NONE &&
/* always issue if it is a request-based RMA,
* otherwise a wait call before unlock will be blocked.*/
curr_op->ureq == NULL) {
/* skip last OP. */
goto finish_issue;
}
......@@ -300,6 +303,12 @@ static inline int issue_ops_target(MPID_Win * win_ptr, MPIDI_RMA_Target_t *targe
MPIU_ERR_POP(mpi_errno);
if (!curr_op->request) {
if (curr_op->ureq) {
/* Complete user request and release the ch3 ref */
MPID_Request_set_completed(curr_op->ureq);
MPID_Request_release(curr_op->ureq);
}
/* Sending is completed immediately. */
MPIDI_CH3I_RMA_Ops_free_elem(win_ptr, &(target->pending_op_list),
&(target->pending_op_list_tail), curr_op);
......@@ -321,6 +330,35 @@ static inline int issue_ops_target(MPID_Win * win_ptr, MPIDI_RMA_Target_t *targe
MPIDI_CH3I_RMA_Ops_append(&(target->read_op_list),
&(target->read_op_list_tail), curr_op);
}
/* Setup user request info in order to be completed following send request.*/
if (curr_op->ureq) {
/* Increase ref for completion handler */
MPIU_Object_add_ref(curr_op->ureq);
curr_op->request->dev.request_handle = curr_op->ureq->handle;
/* Setup user request completion handler.
*
* The handler is triggered when send request is completed at
* following places:
* - progress engine: complete PUT/ACC req.
* - GET/GET_ACC packet handler: complete GET/GET_ACC reqs.
*
* We always set OnFinal which should be called when sending or
* receiving the last segment. However, short put/acc ops are
* issued in one packet and the lower layer only check OnDataAvail
* so we have to set OnDataAvail as well.
*
* Note that a noncontig send also uses OnDataAvail to loop all
* segments but it must be changed to OnFinal when sending the
* last segment, so it is also correct for us.
*
* TODO: implement stack for overriding functions*/
if (curr_op->request->dev.OnDataAvail == NULL) {
curr_op->request->dev.OnDataAvail = MPIDI_CH3_ReqHandler_ReqOpsComplete;
}
curr_op->request->dev.OnFinal = MPIDI_CH3_ReqHandler_ReqOpsComplete;
}
win_ptr->active_req_cnt++;
}
......
......@@ -41,7 +41,8 @@ cvars:
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
origin_datatype, int target_rank, MPI_Aint target_disp,
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr)
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr,
MPID_Request * ureq)
{
int mpi_errno = MPI_SUCCESS;
int dt_contig ATTRIBUTE((unused)), rank;
......@@ -91,6 +92,12 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
target_disp, target_count, target_datatype, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
if (ureq) {
/* Complete user request and release the ch3 ref */
MPID_Request_set_completed(ureq);
MPID_Request_release(ureq);
}
}
else {
MPIDI_RMA_Op_t *new_ptr = NULL;
......@@ -119,6 +126,12 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
new_ptr->target_rank = target_rank;
new_ptr->ureq = NULL; /* reset user request */
/* Remember user request */
if (ureq) {
new_ptr->ureq = ureq;
}
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
......@@ -214,7 +227,8 @@ int MPIDI_Put(const void *origin_addr, int origin_count, MPI_Datatype
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
origin_datatype, int target_rank, MPI_Aint target_disp,
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr)
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr,
MPID_Request * ureq)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_msg_sz_t data_sz;
......@@ -264,6 +278,12 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
target_disp, target_count, target_datatype, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
if (ureq) {
/* Complete user request and release the ch3 ref */
MPID_Request_set_completed(ureq);
MPID_Request_release(ureq);
}
}
else {
MPIDI_RMA_Op_t *new_ptr = NULL;
......@@ -291,6 +311,12 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
new_ptr->target_rank = target_rank;
new_ptr->ureq = NULL; /* reset user request */
/* Remember user request */
if (ureq) {
new_ptr->ureq = ureq;
}
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
......@@ -363,7 +389,8 @@ int MPIDI_Get(void *origin_addr, int origin_count, MPI_Datatype
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
origin_datatype, int target_rank, MPI_Aint target_disp,
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPID_Win * win_ptr)
int target_count, MPI_Datatype target_datatype, MPI_Op op,
MPID_Win * win_ptr, MPID_Request * ureq)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_msg_sz_t data_sz;
......@@ -414,6 +441,12 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
op, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
if (ureq) {
/* Complete user request and release the ch3 ref */
MPID_Request_set_completed(ureq);
MPID_Request_release(ureq);
}
}
else {
MPIDI_RMA_Op_t *new_ptr = NULL;
......@@ -443,6 +476,12 @@ int MPIDI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
new_ptr->origin_count = origin_count;
new_ptr->origin_datatype = origin_datatype;
new_ptr->target_rank = target_rank;
new_ptr->ureq = NULL; /* reset user request */
/* Remember user request */
if (ureq) {
new_ptr->ureq = ureq;
}
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
......@@ -539,7 +578,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPI_Datatype origin_datatype, void *result_addr, int result_count,
MPI_Datatype result_datatype, int target_rank, MPI_Aint target_disp,
int target_count, MPI_Datatype target_datatype, MPI_Op op,
MPID_Win * win_ptr)
MPID_Win * win_ptr, MPID_Request * ureq)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_msg_sz_t data_sz;
......@@ -592,6 +631,12 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
target_datatype, op, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
if (ureq) {
/* Complete user request and release the ch3 ref */
MPID_Request_set_completed(ureq);
MPID_Request_release(ureq);
}
}
else {
MPIDI_RMA_Op_t *new_ptr = NULL;
......@@ -706,6 +751,13 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
}
}
new_ptr->ureq = NULL; /* reset user request */
/* Remember user request */
if (ureq) {
new_ptr->ureq = ureq;
}
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
mpi_errno = MPIDI_CH3I_Win_enqueue_op(win_ptr, new_ptr);
......@@ -831,6 +883,7 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
new_ptr->compare_datatype = datatype;
new_ptr->target_rank = target_rank;
new_ptr->piggyback_lock_candidate = 1; /* CAS is always able to piggyback LOCK */
new_ptr->ureq = NULL; /* reset user request */
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
......@@ -994,6 +1047,8 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
}
}
new_ptr->ureq = NULL; /* reset user request */
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
mpi_errno = MPIDI_CH3I_Win_enqueue_op(win_ptr, new_ptr);
......
......@@ -1253,7 +1253,15 @@ int MPIDI_CH3_PktHandler_Get_AccumResp(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv",
"**ch3|postrecv %s", "MPIDI_CH3_PKT_GET_ACCUM_RESP");
if (complete) {
MPIDI_CH3U_Request_complete(req);
/* Request-based RMA defines final actions for completing user request. */
int (*reqFn)(MPIDI_VC_t *, MPID_Request *, int *);
reqFn = req->dev.OnFinal;
if (reqFn) {
mpi_errno = reqFn(vc, req, &complete);
} else {
MPIDI_CH3U_Request_complete(req);
}
*rreqp = NULL;
}
/* return the number of bytes processed in this function */
......@@ -1363,7 +1371,16 @@ int MPIDI_CH3_PktHandler_GetResp(MPIDI_VC_t * vc ATTRIBUTE((unused)),
MPIU_ERR_CHKANDJUMP1(mpi_errno, mpi_errno, MPI_ERR_OTHER, "**ch3|postrecv", "**ch3|postrecv %s",
"MPIDI_CH3_PKT_GET_RESP");
if (complete) {
MPIDI_CH3U_Request_complete(req);
/* Request-based RMA defines final actions for completing user request. */
int (*reqFn)(MPIDI_VC_t *, MPID_Request *, int *);
reqFn = req->dev.OnFinal;
if (reqFn) {
mpi_errno = reqFn(vc, req, &complete);
} else {
MPIDI_CH3U_Request_complete(req);
}
*rreqp = NULL;
}
/* return the number of bytes processed in this function */
......
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
/*
* (C) 2012 by Argonne National Laboratory.
* (C) 2014 by Argonne National Laboratory.
* See COPYRIGHT in top-level directory.
*/
#include "mpidi_ch3_impl.h"
#include "mpidrma.h"
/* Request-based RMA operations are implemented using generalized requests.
* Below are the generalized request state and handlers for these operations.
*/
typedef struct {
MPID_Request *request;
MPID_Win *win_ptr;
int target_rank;
} req_state_t;
#undef FUNCNAME
#define FUNCNAME req_poll
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int req_poll(void *state, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
req_state_t *req_state = (req_state_t *) state;
MPIU_UNREFERENCED_ARG(status);
/* Call flush to complete the operation. Check that a passive target epoch
* is still active first; the user could complete the request after calling
* unlock. */
/* FIXME: We need per-operation completion to make this more efficient. */
if (req_state->win_ptr->states.access_state == MPIDI_RMA_PER_TARGET ||
req_state->win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_CALLED ||
req_state->win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_ISSUED ||
req_state->win_ptr->states.access_state == MPIDI_RMA_LOCK_ALL_GRANTED) {
mpi_errno = req_state->win_ptr->RMAFns.Win_flush(req_state->target_rank,
req_state->win_ptr);
}
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Grequest_complete_impl(req_state->request);
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME req_wait
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int req_wait(int count, void **states, double timeout, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
int i;
for (i = 0; i < count; i++) {
/* Call poll to complete the operation */
mpi_errno = req_poll(states[i], status);
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME req_query
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int req_query(void *state, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
MPIU_UNREFERENCED_ARG(state);
/* All status fields, except the error code, are undefined */
MPIR_STATUS_SET_COUNT(*status, 0);
MPIR_STATUS_SET_CANCEL_BIT(*status, FALSE);
status->MPI_SOURCE = MPI_UNDEFINED;
status->MPI_TAG = MPI_UNDEFINED;
fn_exit:
status->MPI_ERROR = mpi_errno;
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME req_free
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int req_free(void *state)
{
MPIU_Free(state);
return MPI_SUCCESS;
}
#undef FUNCNAME
#define FUNCNAME req_cancel
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int req_cancel(void *state, int complete)
{
int mpi_errno = MPI_SUCCESS;
MPIU_UNREFERENCED_ARG(state);
/* This operation can't be cancelled */
if (!complete) {
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**rmareqcancel");
}
fn_exit:
return mpi_errno;
fn_fail:
goto fn_exit;
}
#undef FUNCNAME
#define FUNCNAME MPIDI_Rput
#undef FCNAME
......@@ -151,9 +22,7 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
MPID_Datatype *dtp;
MPI_Aint dt_true_lb ATTRIBUTE((unused));
MPIDI_msg_sz_t data_sz;
req_state_t *req_state;
MPIDI_VC_t *orig_vc, *target_vc;
MPIU_CHKPMEM_DECL(1);
MPID_Request *ureq;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_RPUT);
MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_RPUT);
......@@ -165,60 +34,38 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
win_ptr->states.access_state != MPIDI_RMA_LOCK_ALL_GRANTED,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIU_CHKPMEM_MALLOC(req_state, req_state_t *,
sizeof(req_state_t), mpi_errno, "req-based RMA state");
req_state->win_ptr = win_ptr;
req_state->target_rank = target_rank;
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, data_sz, dtp, dt_true_lb);