Commit f039eebb authored by Rob Latham's avatar Rob Latham
Browse files

better approach for do_accumulate_op

commit 83253a41

 triggerd a bunch of new warnings.  Take a different
approach.  For simplicity of implementation, do_accumulate_op is defined
as MPI_User_function.  We could split up internal routine and
user-provided routines, but that complicates the code for little
benefit:

Instead, keep do_accumlate_op with an int type, but check for overflow
before explicitly casting.  In many places the count is simply '1'.  In
stream processing there is an interal limit of 256k, so the assertion
should never fire.
Signed-off-by: default avatarXin Zhao <xinzhao3@illinois.edu>
parent ef34d2c9
......@@ -10,8 +10,8 @@
#include "mpl_utlist.h"
#include "mpid_rma_types.h"
static inline int do_accumulate_op(void *source_buf, MPI_Aint source_count, MPI_Datatype source_dtp,
void *target_buf, MPI_Aint target_count, MPI_Datatype target_dtp,
static inline int do_accumulate_op(void *source_buf, int source_count, MPI_Datatype source_dtp,
void *target_buf, int target_count, MPI_Datatype target_dtp,
MPI_Aint stream_offset, MPI_Op acc_op);
#define ASSIGN_COPY(src, dest, count, type) \
......@@ -399,7 +399,8 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr);
}
mpi_errno = do_accumulate_op((void *) packed_buf, stream_count, basic_type,
MPIU_Assert(stream_count == (int) stream_count);
mpi_errno = do_accumulate_op((void *) packed_buf, (int) stream_count, basic_type,
(void *) ((char *) base + disp_unit * target_disp),
target_count, target_datatype, stream_offset, op);
......@@ -541,7 +542,8 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
packed_buf = tmpbuf;
}
mpi_errno = do_accumulate_op((void *) packed_buf, stream_count, basic_type,
MPIU_Assert(stream_count == (int) stream_count);
mpi_errno = do_accumulate_op((void *) packed_buf, (int) stream_count, basic_type,
(void *) ((char *) base + disp_unit * target_disp),
target_count, target_datatype, stream_offset, op);
......
......@@ -806,8 +806,8 @@ static inline int MPIDI_CH3I_RMA_Handle_flush_ack(MPID_Win * win_ptr, int target
#define FUNCNAME do_accumulate_op
#undef FCNAME
#define FCNAME MPIDI_QUOTE(FUNCNAME)
static inline int do_accumulate_op(void *source_buf, MPI_Aint source_count, MPI_Datatype source_dtp,
void *target_buf, MPI_Aint target_count, MPI_Datatype target_dtp,
static inline int do_accumulate_op(void *source_buf, int source_count, MPI_Datatype source_dtp,
void *target_buf, int target_count, MPI_Datatype target_dtp,
MPI_Aint stream_offset, MPI_Op acc_op)
{
int mpi_errno = MPI_SUCCESS;
......
......@@ -187,7 +187,8 @@ int MPIDI_CH3_ReqHandler_AccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq,
if (win_ptr->shm_allocated == TRUE)
MPIDI_CH3I_SHM_MUTEX_LOCK(win_ptr);
/* accumulate data from tmp_buf into user_buf */
mpi_errno = do_accumulate_op(rreq->dev.user_buf, predef_count, basic_type,
MPIU_Assert(predef_count == (int) predef_count);
mpi_errno = do_accumulate_op(rreq->dev.user_buf, (int) predef_count, basic_type,
rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype,
stream_offset, rreq->dev.op);
if (win_ptr->shm_allocated == TRUE)
......@@ -336,7 +337,8 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq
}
/* accumulate data from tmp_buf into user_buf */
mpi_errno = do_accumulate_op(rreq->dev.user_buf, predef_count, basic_type,
MPIU_Assert(predef_count == (int) predef_count);
mpi_errno = do_accumulate_op(rreq->dev.user_buf, (int) predef_count, basic_type,
rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype,
stream_offset, rreq->dev.op);
......@@ -1245,7 +1247,8 @@ static inline int perform_acc_in_lock_queue(MPID_Win * win_ptr, MPIDI_RMA_Lock_e
/* Note: here stream_offset is 0 because when piggybacking LOCK, we must use
* the first stream unit. */
mpi_errno = do_accumulate_op(lock_entry->data, recv_count, acc_pkt->datatype,
MPIU_Assert(recv_count = (int) recv_count);
mpi_errno = do_accumulate_op(lock_entry->data, (int) recv_count, acc_pkt->datatype,
acc_pkt->addr, acc_pkt->count, acc_pkt->datatype,
0, acc_pkt->op);
}
......@@ -1415,7 +1418,8 @@ static inline int perform_get_acc_in_lock_queue(MPID_Win * win_ptr,
/* Perform ACCUMULATE OP */
mpi_errno = do_accumulate_op(lock_entry->data, recv_count, get_accum_pkt->datatype,
MPIU_Assert(recv_count == (int) recv_count);
mpi_errno = do_accumulate_op(lock_entry->data, (int) recv_count, get_accum_pkt->datatype,
get_accum_pkt->addr, get_accum_pkt->count, get_accum_pkt->datatype,
0, get_accum_pkt->op);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment