Commit fe283e91 authored by Xin Zhao's avatar Xin Zhao
Browse files

Clean up white-space and code format in RMA code.

No reviewer.
parent 9e27235a
This diff is collapsed.
This diff is collapsed.
......@@ -16,7 +16,8 @@ MPIR_T_PVAR_DOUBLE_TIMER_DECL_EXTERN(RMA, rma_rmaqueue_set);
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)
int target_count, MPI_Datatype target_datatype, MPI_Op op,
MPID_Win * win_ptr)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_msg_sz_t data_sz;
......@@ -40,8 +41,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state == MPIDI_EPOCH_NONE,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIDI_Datatype_get_info(target_count, target_datatype, dt_contig, data_sz,
dtp, dt_true_lb);
MPIDI_Datatype_get_info(target_count, target_datatype, dt_contig, data_sz, dtp, dt_true_lb);
if (data_sz == 0) {
goto fn_exit;
......@@ -49,29 +49,30 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
rank = win_ptr->comm_ptr->rank;
if (win_ptr->shm_allocated == TRUE && target_rank != rank && win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
if (win_ptr->shm_allocated == TRUE && target_rank != rank &&
win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
/* check if target is local and shared memory is allocated on window,
if so, we directly perform this operation on shared memory region. */
* if so, we directly perform this operation on shared memory region. */
/* FIXME: Here we decide whether to perform SHM operations by checking if origin and target are on
the same node. However, in ch3:sock, even if origin and target are on the same node, they do
not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
which is only set to TRUE when SHM region is allocated in nemesis.
In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
* the same node. However, in ch3:sock, even if origin and target are on the same node, they do
* not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
* which is only set to TRUE when SHM region is allocated in nemesis.
* In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
MPIDI_Comm_get_vc(win_ptr->comm_ptr, target_rank, &target_vc);
}
/* Do =! rank first (most likely branch?) */
if (target_rank == rank || win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED ||
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id))
{
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id)) {
mpi_errno = MPIDI_CH3I_Shm_get_acc_op(origin_addr, origin_count, origin_datatype,
result_addr, result_count, result_datatype,
target_rank, target_disp, target_count, target_datatype,
op, win_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
target_rank, target_disp, target_count,
target_datatype, op, win_ptr);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
}
else {
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
......@@ -81,7 +82,9 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
/* TODO: Can we use the MPIDI_RMA_ACC_CONTIG optimization? */
......@@ -103,7 +106,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
/* if source or target datatypes are derived, increment their
reference counts */
* reference counts */
if (op != MPI_NO_OP && !MPIR_DATATYPE_IS_PREDEFINED(origin_datatype)) {
MPID_Datatype_get_ptr(origin_datatype, dtp);
MPID_Datatype_add_ref(dtp);
......@@ -118,7 +121,7 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
}
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_GET_ACCUMULATE);
return mpi_errno;
......@@ -134,8 +137,8 @@ int MPIDI_Get_accumulate(const void *origin_addr, int origin_count,
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
void *result_addr, MPI_Datatype datatype, int target_rank,
MPI_Aint target_disp, MPID_Win *win_ptr)
void *result_addr, MPI_Datatype datatype, int target_rank,
MPI_Aint target_disp, MPID_Win * win_ptr)
{
int mpi_errno = MPI_SUCCESS;
int rank;
......@@ -157,16 +160,17 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
rank = win_ptr->comm_ptr->rank;
if (win_ptr->shm_allocated == TRUE && target_rank != rank && win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
if (win_ptr->shm_allocated == TRUE && target_rank != rank &&
win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
/* check if target is local and shared memory is allocated on window,
if so, we directly perform this operation on shared memory region. */
* if so, we directly perform this operation on shared memory region. */
/* FIXME: Here we decide whether to perform SHM operations by checking if origin and target are on
the same node. However, in ch3:sock, even if origin and target are on the same node, they do
not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
which is only set to TRUE when SHM region is allocated in nemesis.
In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
* the same node. However, in ch3:sock, even if origin and target are on the same node, they do
* not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
* which is only set to TRUE when SHM region is allocated in nemesis.
* In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
MPIDI_Comm_get_vc(win_ptr->comm_ptr, target_rank, &target_vc);
}
......@@ -178,11 +182,11 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
/* FIXME: For shared memory windows, we should provide an implementation
* that uses a processor atomic operation. */
if (target_rank == rank || win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED ||
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id))
{
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id)) {
mpi_errno = MPIDI_CH3I_Shm_cas_op(origin_addr, compare_addr, result_addr,
datatype, target_rank, target_disp, win_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
}
else {
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
......@@ -192,7 +196,9 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
new_ptr->type = MPIDI_RMA_COMPARE_AND_SWAP;
......@@ -212,11 +218,11 @@ int MPIDI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_COMPARE_AND_SWAP);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
fn_fail:
goto fn_exit;
/* --END ERROR HANDLING-- */
}
......@@ -228,7 +234,7 @@ fn_fail:
#define FCNAME MPIDI_QUOTE(FUNCNAME)
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_ptr)
MPI_Aint target_disp, MPI_Op op, MPID_Win * win_ptr)
{
int mpi_errno = MPI_SUCCESS;
int rank;
......@@ -250,16 +256,17 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
rank = win_ptr->comm_ptr->rank;
if (win_ptr->shm_allocated == TRUE && target_rank != rank && win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
if (win_ptr->shm_allocated == TRUE && target_rank != rank &&
win_ptr->create_flavor != MPI_WIN_FLAVOR_SHARED) {
/* check if target is local and shared memory is allocated on window,
if so, we directly perform this operation on shared memory region. */
* if so, we directly perform this operation on shared memory region. */
/* FIXME: Here we decide whether to perform SHM operations by checking if origin and target are on
the same node. However, in ch3:sock, even if origin and target are on the same node, they do
not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
which is only set to TRUE when SHM region is allocated in nemesis.
In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
* the same node. However, in ch3:sock, even if origin and target are on the same node, they do
* not within the same SHM region. Here we filter out ch3:sock by checking shm_allocated flag first,
* which is only set to TRUE when SHM region is allocated in nemesis.
* In future we need to figure out a way to check if origin and target are in the same "SHM comm".
*/
MPIDI_Comm_get_vc(win_ptr->comm_ptr, rank, &orig_vc);
MPIDI_Comm_get_vc(win_ptr->comm_ptr, target_rank, &target_vc);
}
......@@ -270,11 +277,11 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
/* FIXME: For shared memory windows, we should provide an implementation
* that uses a processor atomic operation. */
if (target_rank == rank || win_ptr->create_flavor == MPI_WIN_FLAVOR_SHARED ||
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id))
{
(win_ptr->shm_allocated == TRUE && orig_vc->node_id == target_vc->node_id)) {
mpi_errno = MPIDI_CH3I_Shm_fop_op(origin_addr, result_addr, datatype,
target_rank, target_disp, op, win_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
if (mpi_errno)
MPIU_ERR_POP(mpi_errno);
}
else {
MPIDI_RMA_Ops_list_t *ops_list = MPIDI_CH3I_RMA_Get_ops_list(win_ptr, target_rank);
......@@ -284,7 +291,9 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_alloc);
mpi_errno = MPIDI_CH3I_RMA_Ops_alloc_tail(ops_list, &new_ptr);
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_alloc);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_T_PVAR_TIMER_START(RMA, rma_rmaqueue_set);
new_ptr->type = MPIDI_RMA_FETCH_AND_OP;
......@@ -302,11 +311,11 @@ int MPIDI_Fetch_and_op(const void *origin_addr, void *result_addr,
MPIR_T_PVAR_TIMER_END(RMA, rma_rmaqueue_set);
}
fn_exit:
fn_exit:
MPIDI_RMA_FUNC_EXIT(MPID_STATE_MPIDI_FETCH_AND_OP);
return mpi_errno;
/* --BEGIN ERROR HANDLING-- */
fn_fail:
fn_fail:
goto fn_exit;
/* --END ERROR HANDLING-- */
}
This diff is collapsed.
......@@ -14,8 +14,8 @@
typedef struct {
MPID_Request *request;
MPID_Win *win_ptr;
int target_rank;
MPID_Win *win_ptr;
int target_rank;
} MPIDI_CH3I_Rma_req_state_t;
......@@ -23,10 +23,10 @@ typedef struct {
#define FUNCNAME MPIDI_CH3I_Rma_req_poll
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int MPIDI_CH3I_Rma_req_poll(void *state, MPI_Status *status)
static int MPIDI_CH3I_Rma_req_poll(void *state, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
MPIDI_CH3I_Rma_req_state_t *req_state = (MPIDI_CH3I_Rma_req_state_t*) state;
MPIDI_CH3I_Rma_req_state_t *req_state = (MPIDI_CH3I_Rma_req_state_t *) state;
MPIU_UNREFERENCED_ARG(status);
......@@ -35,19 +35,20 @@ static int MPIDI_CH3I_Rma_req_poll(void *state, MPI_Status *status)
* unlock. */
/* FIXME: We need per-operation completion to make this more efficient. */
if (req_state->win_ptr->targets[req_state->target_rank].remote_lock_state
!= MPIDI_CH3_WIN_LOCK_NONE)
{
!= MPIDI_CH3_WIN_LOCK_NONE) {
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); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Grequest_complete_impl(req_state->request);
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -56,8 +57,7 @@ static int MPIDI_CH3I_Rma_req_poll(void *state, MPI_Status *status)
#define FUNCNAME MPIDI_CH3I_Rma_req_wait
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int MPIDI_CH3I_Rma_req_wait(int count, void **states, double timeout,
MPI_Status *status)
static int MPIDI_CH3I_Rma_req_wait(int count, void **states, double timeout, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
int i;
......@@ -65,12 +65,14 @@ static int MPIDI_CH3I_Rma_req_wait(int count, void **states, double timeout,
for (i = 0; i < count; i++) {
/* Call poll to complete the operation */
mpi_errno = MPIDI_CH3I_Rma_req_poll(states[i], status);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -79,7 +81,7 @@ static int MPIDI_CH3I_Rma_req_wait(int count, void **states, double timeout,
#define FUNCNAME MPIDI_CH3I_Rma_req_query
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static int MPIDI_CH3I_Rma_req_query(void *state, MPI_Status *status)
static int MPIDI_CH3I_Rma_req_query(void *state, MPI_Status * status)
{
int mpi_errno = MPI_SUCCESS;
......@@ -91,10 +93,10 @@ static int MPIDI_CH3I_Rma_req_query(void *state, MPI_Status *status)
status->MPI_SOURCE = MPI_UNDEFINED;
status->MPI_TAG = MPI_UNDEFINED;
fn_exit:
fn_exit:
status->MPI_ERROR = mpi_errno;
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -126,9 +128,9 @@ static int MPIDI_CH3I_Rma_req_cancel(void *state, int complete)
MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**rmareqcancel");
}
fn_exit:
fn_exit:
return mpi_errno;
fn_fail:
fn_fail:
goto fn_exit;
}
......@@ -139,8 +141,8 @@ static int MPIDI_CH3I_Rma_req_cancel(void *state, int complete)
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Rput(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,
MPID_Request **request)
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr,
MPID_Request ** request)
{
int mpi_errno = MPI_SUCCESS;
int dt_contig ATTRIBUTE((unused));
......@@ -156,27 +158,25 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
target_rank != MPI_PROC_NULL,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
target_rank != MPI_PROC_NULL, mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
sizeof(MPIDI_CH3I_Rma_req_state_t), mpi_errno,
"req-based RMA state");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t *,
sizeof(MPIDI_CH3I_Rma_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);
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, data_sz, dtp, dt_true_lb);
/* Enqueue or perform the RMA operation */
if (target_rank != MPI_PROC_NULL && data_sz != 0) {
mpi_errno = win_ptr->RMAFns.Put(origin_addr, origin_count,
origin_datatype, target_rank,
target_disp, target_count,
target_datatype, win_ptr);
target_disp, target_count, target_datatype, win_ptr);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
MPIDI_Comm_get_vc(win_ptr->comm_ptr, win_ptr->comm_ptr->rank, &orig_vc);
......@@ -192,7 +192,9 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_free,
MPIDI_CH3I_Rma_req_cancel,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Grequest_complete_impl(req_state->request);
}
......@@ -204,15 +206,17 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_wait,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
*request = req_state->request;
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_RPUT);
return mpi_errno;
fn_fail:
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......@@ -224,8 +228,8 @@ int MPIDI_Rput(const void *origin_addr, int origin_count,
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Rget(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,
MPID_Request **request)
int target_count, MPI_Datatype target_datatype, MPID_Win * win_ptr,
MPID_Request ** request)
{
int mpi_errno = MPI_SUCCESS;
int dt_contig ATTRIBUTE((unused));
......@@ -241,27 +245,25 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
target_rank != MPI_PROC_NULL,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
target_rank != MPI_PROC_NULL, mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
sizeof(MPIDI_CH3I_Rma_req_state_t), mpi_errno,
"req-based RMA state");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t *,
sizeof(MPIDI_CH3I_Rma_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);
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, data_sz, dtp, dt_true_lb);
/* Enqueue or perform the RMA operation */
if (target_rank != MPI_PROC_NULL && data_sz != 0) {
mpi_errno = win_ptr->RMAFns.Get(origin_addr, origin_count,
origin_datatype, target_rank,
target_disp, target_count,
target_datatype, win_ptr);
target_disp, target_count, target_datatype, win_ptr);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
MPIDI_Comm_get_vc(win_ptr->comm_ptr, win_ptr->comm_ptr->rank, &orig_vc);
......@@ -277,7 +279,9 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_free,
MPIDI_CH3I_Rma_req_cancel,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Grequest_complete_impl(req_state->request);
}
......@@ -289,15 +293,17 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_wait,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
*request = req_state->request;
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_RGET);
return mpi_errno;
fn_fail:
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......@@ -309,8 +315,8 @@ int MPIDI_Rget(void *origin_addr, int origin_count,
#define FCNAME MPIDI_QUOTE(FUNCNAME)
int MPIDI_Raccumulate(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,
MPID_Request **request)
int target_count, MPI_Datatype target_datatype, MPI_Op op, MPID_Win * win_ptr,
MPID_Request ** request)
{
int mpi_errno = MPI_SUCCESS;
int dt_contig ATTRIBUTE((unused));
......@@ -326,18 +332,15 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
target_rank != MPI_PROC_NULL,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
target_rank != MPI_PROC_NULL, mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
sizeof(MPIDI_CH3I_Rma_req_state_t), mpi_errno,
"req-based RMA state");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t *,
sizeof(MPIDI_CH3I_Rma_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);
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, data_sz, dtp, dt_true_lb);
/* Enqueue or perform the RMA operation */
if (target_rank != MPI_PROC_NULL && data_sz != 0) {
......@@ -345,7 +348,9 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
origin_datatype, target_rank,
target_disp, target_count,
target_datatype, op, win_ptr);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
MPIDI_Comm_get_vc(win_ptr->comm_ptr, win_ptr->comm_ptr->rank, &orig_vc);
......@@ -361,7 +366,9 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_free,
MPIDI_CH3I_Rma_req_cancel,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Grequest_complete_impl(req_state->request);
}
......@@ -373,15 +380,17 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
MPIDI_CH3I_Rma_req_wait,
req_state, &req_state->request);
if (mpi_errno != MPI_SUCCESS) { MPIU_ERR_POP(mpi_errno); }
if (mpi_errno != MPI_SUCCESS) {
MPIU_ERR_POP(mpi_errno);
}
}
*request = req_state->request;
fn_exit:
fn_exit:
MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_RACCUMULATE);
return mpi_errno;
fn_fail:
fn_fail:
MPIU_CHKPMEM_REAP();
goto fn_exit;
}
......@@ -394,8 +403,8 @@ int MPIDI_Raccumulate(const void *origin_addr, int origin_count,
int MPIDI_Rget_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_Request **request)
int target_count, MPI_Datatype target_datatype, MPI_Op op,
MPID_Win * win_ptr, MPID_Request ** request)
{
int mpi_errno = MPI_SUCCESS;
int dt_contig ATTRIBUTE((unused));
......@@ -411,21 +420,17 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
MPIU_ERR_CHKANDJUMP(win_ptr->epoch_state != MPIDI_EPOCH_LOCK &&
win_ptr->epoch_state != MPIDI_EPOCH_LOCK_ALL &&
target_rank != MPI_PROC_NULL,
mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
target_rank != MPI_PROC_NULL, mpi_errno, MPI_ERR_RMA_SYNC, "**rmasync");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t*,
sizeof(MPIDI_CH3I_Rma_req_state_t), mpi_errno,
"req-based RMA state");
MPIU_CHKPMEM_MALLOC(req_state, MPIDI_CH3I_Rma_req_state_t *,
sizeof(MPIDI_CH3I_Rma_req_state_t), mpi_errno, "req-based RMA state");
req_state->win_ptr = win_ptr;
req_state->target_rank = target_rank;
/* Note that GACC is only a no-op if no data goes in both directions */
MPIDI_Datatype_get_info(origin_count, origin_datatype,
dt_contig, data_sz, dtp, dt_true_lb);
MPIDI_Datatype_get_info(origin_count, origin_datatype,
dt_contig, trg_data_sz, dtp, dt_true_lb);
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, data_sz, dtp, dt_true_lb);
MPIDI_Datatype_get_info(origin_count, origin_datatype, dt_contig, trg_data_sz, dtp, dt_true_lb);
/* Enqueue or perform the RMA operation */
if (target_rank != MPI_PROC_NULL && (data_sz != 0 || trg_data_sz != 0)) {
......@@ -433,9 +438,10 @@ int MPIDI_Rget_accumulate(const void *origin_addr, int origin_count,
origin_datatype, result_addr,
result_count, result_datatype,
target_rank, target_disp,