Commit 04deb880 authored by Xin Zhao's avatar Xin Zhao Committed by Pavan Balaji
Browse files

Rename predefined_type / predef_type to basic_type.



In MPI standard, predefined datatype is called as basic type.
It is better to make the name same with the standard in the
code.
Signed-off-by: Pavan Balaji's avatarPavan Balaji <balaji@anl.gov>
parent b796fa1e
......@@ -306,7 +306,7 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
int disp_unit, shm_op = 0;
int mpi_errno = MPI_SUCCESS;
int i;
MPI_Datatype predefined_type;
MPI_Datatype basic_type;
MPI_Aint stream_elem_count, stream_unit_count;
MPI_Aint predefined_dtp_size, predefined_dtp_extent, predefined_dtp_count;
MPI_Aint total_len, rest_len;
......@@ -350,10 +350,10 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
MPID_Datatype_get_ptr(origin_datatype, origin_dtp_ptr);
MPIU_Assert(origin_dtp_ptr != NULL && origin_dtp_ptr->basic_type != MPI_DATATYPE_NULL);
predefined_type = origin_dtp_ptr->basic_type;
MPID_Datatype_get_size_macro(predefined_type, predefined_dtp_size);
basic_type = origin_dtp_ptr->basic_type;
MPID_Datatype_get_size_macro(basic_type, predefined_dtp_size);
predefined_dtp_count = total_len / predefined_dtp_size;
MPID_Datatype_get_extent_macro(predefined_type, predefined_dtp_extent);
MPID_Datatype_get_extent_macro(basic_type, predefined_dtp_extent);
MPIU_Assert(predefined_dtp_count > 0 && predefined_dtp_size > 0 && predefined_dtp_extent > 0);
stream_elem_count = MPIDI_CH3U_Acc_stream_size / predefined_dtp_extent;
......@@ -384,11 +384,11 @@ static inline int MPIDI_CH3I_Shm_acc_op(const void *origin_addr, int origin_coun
MPID_Segment_pack(seg, first, &last, packed_buf);
MPID_Segment_free(seg);
MPID_Datatype_is_contig(predefined_type, &is_predef_contig);
MPID_Datatype_is_contig(basic_type, &is_predef_contig);
if (!is_predef_contig) {
void *tmpbuf = MPIU_Malloc(stream_count * predefined_dtp_extent);
mpi_errno = MPIR_Localcopy(tmpbuf, stream_count, predefined_type,
mpi_errno = MPIR_Localcopy(tmpbuf, stream_count, basic_type,
packed_buf, stream_size, MPI_BYTE);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
MPIU_Free(packed_buf);
......@@ -399,7 +399,7 @@ 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, predefined_type,
mpi_errno = do_accumulate_op((void*)packed_buf, stream_count, basic_type,
(void*)((char*)base+disp_unit*target_disp), target_count, target_datatype,
stream_offset, op);
......@@ -436,7 +436,7 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
int disp_unit, shm_locked = 0;
void *base = NULL;
int i;
MPI_Datatype predefined_type;
MPI_Datatype basic_type;
MPI_Aint stream_elem_count, stream_unit_count;
MPI_Aint predefined_dtp_size, predefined_dtp_extent, predefined_dtp_count;
MPI_Aint total_len, rest_len;
......@@ -497,10 +497,10 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
MPID_Datatype_get_ptr(origin_datatype, origin_dtp_ptr);
MPIU_Assert(origin_dtp_ptr != NULL && origin_dtp_ptr->basic_type != MPI_DATATYPE_NULL);
predefined_type = origin_dtp_ptr->basic_type;
MPID_Datatype_get_size_macro(predefined_type, predefined_dtp_size);
basic_type = origin_dtp_ptr->basic_type;
MPID_Datatype_get_size_macro(basic_type, predefined_dtp_size);
predefined_dtp_count = total_len / predefined_dtp_size;
MPID_Datatype_get_extent_macro(predefined_type, predefined_dtp_extent);
MPID_Datatype_get_extent_macro(basic_type, predefined_dtp_extent);
MPIU_Assert(predefined_dtp_count > 0 && predefined_dtp_size > 0 && predefined_dtp_extent > 0);
stream_elem_count = MPIDI_CH3U_Acc_stream_size / predefined_dtp_extent;
......@@ -531,18 +531,18 @@ static inline int MPIDI_CH3I_Shm_get_acc_op(const void *origin_addr, int origin_
MPID_Segment_pack(seg, first, &last, packed_buf);
MPID_Segment_free(seg);
MPID_Datatype_is_contig(predefined_type, &is_predef_contig);
MPID_Datatype_is_contig(basic_type, &is_predef_contig);
if (!is_predef_contig) {
void *tmpbuf = MPIU_Malloc(stream_count * predefined_dtp_extent);
mpi_errno = MPIR_Localcopy(tmpbuf, stream_count, predefined_type,
mpi_errno = MPIR_Localcopy(tmpbuf, stream_count, basic_type,
packed_buf, stream_size, MPI_BYTE);
if (mpi_errno != MPI_SUCCESS) MPIU_ERR_POP(mpi_errno);
MPIU_Free(packed_buf);
packed_buf = tmpbuf;
}
mpi_errno = do_accumulate_op((void*)packed_buf, stream_count, predefined_type,
mpi_errno = do_accumulate_op((void*)packed_buf, stream_count, basic_type,
(void*)((char*)base+disp_unit*target_disp), target_count, target_datatype,
stream_offset, op);
......
......@@ -137,7 +137,7 @@ int MPIDI_CH3_ReqHandler_AccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq,
MPID_Win *win_ptr;
MPI_Win source_win_handle = rreq->dev.source_win_handle;
MPIDI_CH3_Pkt_flags_t flags = rreq->dev.flags;
MPI_Datatype predef_datatype;
MPI_Datatype basic_type;
MPI_Aint predef_count, predef_dtp_size;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_ACCUMRECVCOMPLETE);
......@@ -166,20 +166,20 @@ int MPIDI_CH3_ReqHandler_AccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq,
MPIU_Assert(MPIDI_Request_get_type(rreq) == MPIDI_REQUEST_TYPE_ACCUM_RECV);
if (MPIR_DATATYPE_IS_PREDEFINED(rreq->dev.datatype))
predef_datatype = rreq->dev.datatype;
basic_type = rreq->dev.datatype;
else {
predef_datatype = rreq->dev.datatype_ptr->basic_type;
basic_type = rreq->dev.datatype_ptr->basic_type;
}
MPIU_Assert(predef_datatype != MPI_DATATYPE_NULL);
MPIU_Assert(basic_type != MPI_DATATYPE_NULL);
MPID_Datatype_get_size_macro(predef_datatype, predef_dtp_size);
MPID_Datatype_get_size_macro(basic_type, predef_dtp_size);
predef_count = rreq->dev.recv_data_sz / predef_dtp_size;
MPIU_Assert(predef_count > 0);
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, predef_datatype,
mpi_errno = do_accumulate_op(rreq->dev.user_buf, predef_count, basic_type,
rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype,
rreq->dev.stream_offset, rreq->dev.op);
if (win_ptr->shm_allocated == TRUE)
......@@ -230,7 +230,7 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq
MPID_IOV iov[MPID_IOV_LIMIT];
int iovcnt;
int is_contig;
MPI_Datatype predef_datatype;
MPI_Datatype basic_type;
MPI_Aint predef_count, predef_dtp_size;
MPIU_CHKPMEM_DECL(1);
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMRECVCOMPLETE);
......@@ -240,13 +240,13 @@ int MPIDI_CH3_ReqHandler_GaccumRecvComplete(MPIDI_VC_t * vc, MPID_Request * rreq
MPID_Win_get_ptr(rreq->dev.target_win_handle, win_ptr);
if (MPIR_DATATYPE_IS_PREDEFINED(rreq->dev.datatype))
predef_datatype = rreq->dev.datatype;
basic_type = rreq->dev.datatype;
else {
predef_datatype = rreq->dev.datatype_ptr->basic_type;
basic_type = rreq->dev.datatype_ptr->basic_type;
}
MPIU_Assert(predef_datatype != MPI_DATATYPE_NULL);
MPIU_Assert(basic_type != MPI_DATATYPE_NULL);
MPID_Datatype_get_size_macro(predef_datatype, predef_dtp_size);
MPID_Datatype_get_size_macro(basic_type, predef_dtp_size);
predef_count = rreq->dev.recv_data_sz / predef_dtp_size;
MPIU_Assert(predef_count > 0);
......@@ -298,7 +298,7 @@ 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, predef_datatype,
mpi_errno = do_accumulate_op(rreq->dev.user_buf, predef_count, basic_type,
rreq->dev.real_user_buf, rreq->dev.user_count, rreq->dev.datatype,
rreq->dev.stream_offset, rreq->dev.op);
......@@ -532,7 +532,7 @@ int MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((u
{
int mpi_errno = MPI_SUCCESS;
MPID_Datatype *new_dtp = NULL;
MPI_Aint predef_type_extent, predef_type_size;
MPI_Aint basic_type_extent, basic_type_size;
MPI_Aint total_len, rest_len, stream_elem_count;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_ACCUMDERIVEDDTRECVCOMPLETE);
......@@ -544,8 +544,8 @@ int MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((u
/* update new request to get the data */
MPIDI_Request_set_type(rreq, MPIDI_REQUEST_TYPE_ACCUM_RECV);
MPID_Datatype_get_size_macro(new_dtp->basic_type, predef_type_size);
MPID_Datatype_get_extent_macro(new_dtp->basic_type, predef_type_extent);
MPID_Datatype_get_size_macro(new_dtp->basic_type, basic_type_size);
MPID_Datatype_get_extent_macro(new_dtp->basic_type, basic_type_extent);
MPIU_Assert(!MPIDI_Request_get_srbuf_flag(rreq));
/* allocate a SRBuf for receiving stream unit */
......@@ -566,9 +566,9 @@ int MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((u
total_len = new_dtp->size * rreq->dev.user_count;
rest_len = total_len - rreq->dev.stream_offset;
stream_elem_count = MPIDI_CH3U_SRBuf_size / predef_type_extent;
stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * predef_type_size);
rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
rreq->dev.datatype_ptr = new_dtp;
/* this will cause the datatype to be freed when the
* request is freed. free dtype_info here. */
......@@ -579,7 +579,7 @@ int MPIDI_CH3_ReqHandler_AccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((u
"**nomem %s", "MPID_Segment_alloc");
MPID_Segment_init(rreq->dev.user_buf,
(rreq->dev.recv_data_sz / predef_type_size),
(rreq->dev.recv_data_sz / basic_type_size),
new_dtp->basic_type, rreq->dev.segment_ptr, 0);
rreq->dev.segment_first = 0;
rreq->dev.segment_size = rreq->dev.recv_data_sz;
......@@ -607,7 +607,7 @@ int MPIDI_CH3_ReqHandler_GaccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((
{
int mpi_errno = MPI_SUCCESS;
MPID_Datatype *new_dtp = NULL;
MPI_Aint predef_type_extent, predef_type_size;
MPI_Aint basic_type_extent, basic_type_size;
MPI_Aint total_len, rest_len, stream_elem_count;
MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3_REQHANDLER_GACCUMDERIVEDDTRECVCOMPLETE);
......@@ -619,8 +619,8 @@ int MPIDI_CH3_ReqHandler_GaccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((
/* update new request to get the data */
MPIDI_Request_set_type(rreq, MPIDI_REQUEST_TYPE_GET_ACCUM_RECV);
MPID_Datatype_get_size_macro(new_dtp->basic_type, predef_type_size);
MPID_Datatype_get_extent_macro(new_dtp->basic_type, predef_type_extent);
MPID_Datatype_get_size_macro(new_dtp->basic_type, basic_type_size);
MPID_Datatype_get_extent_macro(new_dtp->basic_type, basic_type_extent);
MPIU_Assert(!MPIDI_Request_get_srbuf_flag(rreq));
/* allocate a SRBuf for receiving stream unit */
......@@ -641,9 +641,9 @@ int MPIDI_CH3_ReqHandler_GaccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((
total_len = new_dtp->size * rreq->dev.user_count;
rest_len = total_len - rreq->dev.stream_offset;
stream_elem_count = MPIDI_CH3U_SRBuf_size / predef_type_extent;
stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * predef_type_size);
rreq->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
rreq->dev.datatype_ptr = new_dtp;
/* this will cause the datatype to be freed when the
* request is freed. free dtype_info here. */
......@@ -654,7 +654,7 @@ int MPIDI_CH3_ReqHandler_GaccumDerivedDTRecvComplete(MPIDI_VC_t * vc ATTRIBUTE((
"**nomem %s", "MPID_Segment_alloc");
MPID_Segment_init(rreq->dev.user_buf,
(rreq->dev.recv_data_sz / predef_type_size),
(rreq->dev.recv_data_sz / basic_type_size),
new_dtp->basic_type, rreq->dev.segment_ptr, 0);
rreq->dev.segment_first = 0;
rreq->dev.segment_size = rreq->dev.recv_data_sz;
......
......@@ -1505,29 +1505,29 @@ int MPIDI_CH3_PktHandler_Get_AccumResp(MPIDI_VC_t * vc, MPIDI_CH3_Pkt_t * pkt,
else {
MPIU_Assert(pkt->type == MPIDI_CH3_PKT_GET_ACCUM_RESP);
MPI_Datatype predef_type;
MPI_Aint predef_type_extent, predef_type_size;
MPI_Datatype basic_type;
MPI_Aint basic_type_extent, basic_type_size;
MPI_Aint stream_elem_count;
MPI_Aint total_len, rest_len;
MPI_Aint real_stream_offset;
if (MPIR_DATATYPE_IS_PREDEFINED(req->dev.datatype)) {
predef_type = req->dev.datatype;
basic_type = req->dev.datatype;
}
else {
MPIU_Assert(req->dev.datatype_ptr != NULL);
predef_type = req->dev.datatype_ptr->basic_type;
basic_type = req->dev.datatype_ptr->basic_type;
}
MPID_Datatype_get_extent_macro(predef_type, predef_type_extent);
MPID_Datatype_get_size_macro(predef_type, predef_type_size);
MPID_Datatype_get_extent_macro(basic_type, basic_type_extent);
MPID_Datatype_get_size_macro(basic_type, basic_type_size);
total_len = type_size * req->dev.user_count;
rest_len = total_len - req->dev.stream_offset;
stream_elem_count = MPIDI_CH3U_SRBuf_size / predef_type_extent;
stream_elem_count = MPIDI_CH3U_SRBuf_size / basic_type_extent;
req->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * predef_type_size);
real_stream_offset = (req->dev.stream_offset / predef_type_size) * predef_type_extent;
req->dev.recv_data_sz = MPIR_MIN(rest_len, stream_elem_count * basic_type_size);
real_stream_offset = (req->dev.stream_offset / basic_type_size) * basic_type_extent;
if (MPIR_DATATYPE_IS_PREDEFINED(req->dev.datatype)) {
req->dev.user_buf = (void *) ((char *) req->dev.user_buf + real_stream_offset);
......
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