Commit a3f0e65d authored by Darius Buntinas's avatar Darius Buntinas
Browse files

[svn-r6963] NMPI_ to MPIR_ changes for datatypes. Reviewed by balaji@

parent 023c7de2
......@@ -26,14 +26,10 @@ static F90Predefined f90Types[MAX_F90_TYPES];
static int MPIR_FreeF90Datatypes( void *d )
{
int i;
MPIU_THREADPRIV_DECL;
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
for (i=0; i<nAlloc; i++) {
NMPI_Type_free( &f90Types[i].d );
MPIR_Type_free_impl( &f90Types[i].d );
}
MPIR_Nest_decr();
return 0;
}
......
......@@ -3473,6 +3473,8 @@ int MPIU_Get_intranode_rank(MPID_Comm *comm_ptr, int r);
#define MPIR_Comm_rank(comm_ptr) ((comm_ptr)->rank)
#define MPIR_Comm_size(comm_ptr) ((comm_ptr)->local_size)
#define MPIR_Type_extent_impl(datatype, extent_ptr) MPID_Datatype_get_extent_macro(datatype, *(extent_ptr))
#define MPIR_Type_size_impl(datatype, size) MPID_Datatype_get_size_macro(datatype, *(size))
/* MPIR_ functions. These are versions of MPI_ functions appropriate for calling within MPI */
int MPIR_Cancel_impl(MPID_Request *request_ptr);
......@@ -3509,6 +3511,30 @@ int MPIR_Comm_remote_group_impl(MPID_Comm *comm_ptr, MPID_Group **group_ptr);
int MPIR_Comm_split(MPID_Comm *comm_ptr, int color, int key, MPID_Comm **newcomm_ptr);
void MPIR_Group_compare_impl(MPID_Group *group_ptr1, MPID_Group *group_ptr2, int *result);
int MPIR_Group_free_impl(MPID_Group *group_ptr);
int MPIR_Type_commit_impl(MPI_Datatype *datatype);
int MPIR_Type_create_struct_impl(int count,
int array_of_blocklengths[],
MPI_Aint array_of_displacements[],
MPI_Datatype array_of_types[],
MPI_Datatype *newtype);
int MPIR_Type_create_indexed_block_impl(int count,
int blocklength,
int array_of_displacements[],
MPI_Datatype oldtype,
MPI_Datatype *newtype);
int MPIR_Type_contiguous_impl(int count,
MPI_Datatype old_type,
MPI_Datatype *new_type_p);
void MPIR_Type_get_extent_impl(MPI_Datatype datatype, MPI_Aint *lb, MPI_Aint *extent);
void MPIR_Type_get_true_extent_impl(MPI_Datatype datatype, MPI_Aint *true_lb, MPI_Aint *true_extent);
void MPIR_Type_get_envelope_impl(MPI_Datatype datatype, int *num_integers, int *num_addresses,
int *num_datatypes, int *combiner);
int MPIR_Type_hvector_impl(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype *newtype_p);
int MPIR_Type_indexed_impl(int count, int blocklens[], int indices[], MPI_Datatype old_type,
MPI_Datatype *newtype);
void MPIR_Type_free_impl(MPI_Datatype *datatype);
int MPIR_Type_vector_impl(int count, int blocklength, int stride, MPI_Datatype old_type, MPI_Datatype *newtype_p);
int MPIR_Type_struct_impl(int count, int blocklens[], MPI_Aint indices[], MPI_Datatype old_types[], MPI_Datatype *newtype);
......
......@@ -38,20 +38,11 @@
#define NMPI_Send MPI_Send
#define NMPI_Waitall MPI_Waitall
#define NMPI_Sendrecv MPI_Sendrecv
#define NMPI_Type_extent MPI_Type_extent
#define NMPI_Type_lb MPI_Type_lb
#define NMPI_Type_indexed MPI_Type_indexed
#define NMPI_Type_commit MPI_Type_commit
#define NMPI_Type_free MPI_Type_free
#define NMPI_Type_size MPI_Type_size
#define NMPI_Type_get_extent MPI_Type_get_extent
#define NMPI_Graph_map MPI_Graph_map
#define NMPI_Iprobe MPI_Iprobe
#define NMPI_Probe MPI_Probe
#define NMPI_Type_get_true_extent MPI_Type_get_true_extent
#define NMPI_Group_translate_ranks MPI_Group_translate_ranks
#define NMPI_Type_create_indexed_block MPI_Type_create_indexed_block
#define NMPI_Type_create_struct MPI_Type_create_struct
#define NMPI_Wtime MPI_Wtime
#define NMPI_Info_create MPI_Info_create
#define NMPI_Info_set MPI_Info_set
......@@ -61,13 +52,7 @@
#define NMPI_Test_cancelled MPI_Test_cancelled
#define NMPI_Ibsend MPI_Ibsend
#define NMPI_Buffer_detach MPI_Buffer_detach
#define NMPI_Type_get_envelope MPI_Type_get_envelope
#define NMPI_Type_contiguous MPI_Type_contiguous
#define NMPI_Type_vector MPI_Type_vector
#define NMPI_Type_hvector MPI_Type_hvector
#define NMPI_Type_indexed MPI_Type_indexed
#define NMPI_Type_hindexed MPI_Type_hindexed
#define NMPI_Type_struct MPI_Type_struct
#define NMPIX_Grequest_class_create MPIX_Grequest_class_create
#define NMPIX_Grequest_class_allocate MPIX_Grequest_class_allocate
#define NMPIX_Grequest_start MPIX_Grequest_start
......@@ -87,20 +72,11 @@
#define NMPI_Send PMPI_Send
#define NMPI_Waitall PMPI_Waitall
#define NMPI_Sendrecv PMPI_Sendrecv
#define NMPI_Type_extent PMPI_Type_extent
#define NMPI_Type_lb PMPI_Type_lb
#define NMPI_Type_indexed PMPI_Type_indexed
#define NMPI_Type_commit PMPI_Type_commit
#define NMPI_Type_free PMPI_Type_free
#define NMPI_Type_size PMPI_Type_size
#define NMPI_Type_get_extent PMPI_Type_get_extent
#define NMPI_Graph_map PMPI_Graph_map
#define NMPI_Iprobe PMPI_Iprobe
#define NMPI_Probe PMPI_Probe
#define NMPI_Type_get_true_extent PMPI_Type_get_true_extent
#define NMPI_Group_translate_ranks PMPI_Group_translate_ranks
#define NMPI_Type_create_indexed_block PMPI_Type_create_indexed_block
#define NMPI_Type_create_struct PMPI_Type_create_struct
#define NMPI_Wtime PMPI_Wtime
#define NMPI_Info_create PMPI_Info_create
#define NMPI_Info_set PMPI_Info_set
......@@ -110,13 +86,7 @@
#define NMPI_Test_cancelled PMPI_Test_cancelled
#define NMPI_Ibsend PMPI_Ibsend
#define NMPI_Buffer_detach PMPI_Buffer_detach
#define NMPI_Type_get_envelope PMPI_Type_get_envelope
#define NMPI_Type_contiguous PMPI_Type_contiguous
#define NMPI_Type_vector PMPI_Type_vector
#define NMPI_Type_hvector PMPI_Type_hvector
#define NMPI_Type_indexed PMPI_Type_indexed
#define NMPI_Type_hindexed PMPI_Type_hindexed
#define NMPI_Type_struct PMPI_Type_struct
#define NMPIX_Grequest_class_create PMPIX_Grequest_class_create
#define NMPIX_Grequest_class_allocate PMPIX_Grequest_class_allocate
#define NMPIX_Grequest_start PMPIX_Grequest_start
......
......@@ -430,11 +430,7 @@ int MPIR_Allgather_intra (
/* allocate a temporary buffer of the same size as recvbuf. */
/* get true extent of recvtype */
mpi_errno = NMPI_Type_get_true_extent(recvtype, &recvtype_true_lb,
&recvtype_true_extent);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
recvbuf_extent = recvcount * comm_size *
(MPIR_MAX(recvtype_true_extent, recvtype_extent));
......@@ -610,10 +606,8 @@ int MPIR_Allgather_inter (
if ((rank == 0) && (sendcount != 0)) {
/* In each group, rank 0 allocates temp. buffer for local
gather */
mpi_errno = NMPI_Type_get_true_extent(sendtype, &true_lb, &true_extent);
if (mpi_errno) {
MPIU_ERR_POP(mpi_errno);
}
MPIR_Type_get_true_extent_impl(sendtype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro( sendtype, send_extent );
extent = MPIR_MAX(send_extent, true_extent);
......
......@@ -125,9 +125,7 @@ int MPIR_Allgatherv_intra (
/* need to receive contiguously into tmp_buf because
displs could make the recvbuf noncontiguous */
mpi_errno = NMPI_Type_get_true_extent(recvtype, &recvtype_true_lb,
&recvtype_true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
MPID_Ensure_Aint_fits_in_pointer(total_count *
(MPIR_MAX(recvtype_true_extent, recvtype_extent)));
......@@ -482,10 +480,7 @@ int MPIR_Allgatherv_intra (
/* allocate a temporary buffer of the same size as recvbuf. */
/* get true extent of recvtype */
mpi_errno = NMPI_Type_get_true_extent(recvtype,
&recvtype_true_lb,
&recvtype_true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
MPID_Ensure_Aint_fits_in_pointer(total_count *
MPIR_MAX(recvtype_true_extent, recvtype_extent));
......@@ -745,20 +740,22 @@ int MPIR_Allgatherv_inter (
newcomm_ptr = comm_ptr->local_comm;
NMPI_Type_indexed(remote_size, recvcounts, displs, recvtype,
&newtype);
NMPI_Type_commit(&newtype);
mpi_errno = MPIR_Type_indexed_impl(remote_size, recvcounts, displs, recvtype, &newtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&newtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Bcast_intra(recvbuf, 1, newtype, 0, newcomm_ptr);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
NMPI_Type_free(&newtype);
MPIR_Type_free_impl(&newtype);
fn_exit:
return mpi_errno;
fn_fail:
if (newtype != MPI_DATATYPE_NULL)
NMPI_Type_free(&newtype);
MPIR_Type_free_impl(&newtype);
goto fn_exit;
}
......
......@@ -262,9 +262,7 @@ int MPIR_Allreduce_intra (
}
/* need to allocate temporary buffer to store incoming data*/
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
MPID_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
......
......@@ -205,12 +205,12 @@ int MPIR_Alltoall_intra(
}
}
mpi_errno = NMPI_Type_create_indexed_block(count, recvcount,
displs, recvtype, &newtype);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
mpi_errno = MPIR_Type_create_indexed_block_impl(count, recvcount,
displs, recvtype, &newtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = NMPI_Type_commit(&newtype);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
mpi_errno = MPIR_Type_commit_impl(&newtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
position = 0;
mpi_errno = NMPI_Pack(recvbuf, 1, newtype, tmp_buf, pack_size,
......@@ -223,8 +223,7 @@ int MPIR_Alltoall_intra(
MPI_STATUS_IGNORE);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
mpi_errno = NMPI_Type_free(&newtype);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_free_impl(&newtype);
pof2 *= 2;
}
......@@ -233,9 +232,7 @@ int MPIR_Alltoall_intra(
* a temporary buffer of the same size as recvbuf. */
/* get true extent of recvtype */
mpi_errno = NMPI_Type_get_true_extent(recvtype, &recvtype_true_lb,
&recvtype_true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
recvbuf_extent = recvcount * comm_size *
(MPIR_MAX(recvtype_true_extent, recvtype_extent));
......@@ -273,9 +270,7 @@ int MPIR_Alltoall_intra(
sendbuf_extent*comm_size */
/* get true extent of sendtype */
mpi_errno = NMPI_Type_get_true_extent(sendtype, &sendtype_true_lb,
&sendtype_true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(sendtype, &sendtype_true_lb, &sendtype_true_extent);
sendbuf_extent = sendcount * comm_size *
(MPIR_MAX(sendtype_true_extent, sendtype_extent));
......@@ -524,7 +519,7 @@ int MPIR_Alltoall_intra(
return (mpi_errno);
fn_fail:
if (newtype != MPI_DATATYPE_NULL)
NMPI_Type_free(&newtype);
MPIR_Type_free_impl(&newtype);
goto fn_exit;
}
/* end:nested */
......
......@@ -411,9 +411,7 @@ static int MPIR_Bcast_scatter_doubling_allgather(
if (is_contig && is_homogeneous)
{
/* contiguous and homogeneous. no need to pack. */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
tmp_buf = (char *) buffer + true_lb;
}
......@@ -670,9 +668,7 @@ static int MPIR_Bcast_scatter_ring_allgather(
if (is_contig && is_homogeneous)
{
/* contiguous and homogeneous. no need to pack. */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
tmp_buf = (char *) buffer + true_lb;
}
......
......@@ -122,7 +122,7 @@ int MPIR_Exscan (
if (count == 0) return MPI_SUCCESS;
MPIU_THREADPRIV_GET;
comm = comm_ptr->handle;
comm_size = comm_ptr->local_size;
rank = comm_ptr->rank;
......@@ -156,11 +156,7 @@ int MPIR_Exscan (
}
/* need to allocate temporary buffer to store partial scan*/
MPIR_Nest_incr();
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
MPIR_Nest_decr();
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro( datatype, extent );
......
......@@ -213,17 +213,20 @@ int MPIR_Gather_intra (
blocks[1] = (recvcnt * recvblks) - blocks[0];
displs[1] = 0;
NMPI_Type_indexed(2, blocks, displs, recvtype, &tmp_type);
NMPI_Type_commit(&tmp_type);
mpi_errno = MPIR_Type_indexed_impl(2, blocks, displs, recvtype, &tmp_type);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&tmp_type);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIC_Recv(recvbuf, 1, tmp_type, src,
MPIR_GATHER_TAG, comm, &status);
if (mpi_errno) {
NMPI_Type_free(&tmp_type);
MPIR_Type_free_impl(&tmp_type);
MPIU_ERR_POP(mpi_errno);
}
NMPI_Type_free(&tmp_type);
MPIR_Type_free_impl(&tmp_type);
}
}
else /* Intermediate nodes store in temporary buffer */
......@@ -274,16 +277,19 @@ int MPIR_Gather_intra (
struct_displs[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
types[1] = MPI_BYTE;
NMPI_Type_create_struct(2, blocks, struct_displs, types, &tmp_type);
NMPI_Type_commit(&tmp_type);
mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&tmp_type);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIC_Send(MPI_BOTTOM, 1, tmp_type, dst,
MPIR_GATHER_TAG, comm);
if (mpi_errno) {
NMPI_Type_free(&tmp_type);
MPIR_Type_free_impl(&tmp_type);
MPIU_ERR_POP(mpi_errno);
}
NMPI_Type_free(&tmp_type);
MPIR_Type_free_impl(&tmp_type);
}
break;
......@@ -490,10 +496,7 @@ int MPIR_Gather_inter (
if (rank == 0)
{
mpi_errno = NMPI_Type_get_true_extent(sendtype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(sendtype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(sendtype, extent);
MPID_Ensure_Aint_fits_in_pointer(sendcnt*local_size*
......
......@@ -324,11 +324,8 @@ int MPIR_Localcopy(void *sendbuf, int sendcount, MPI_Datatype sendtype,
copy_sz = sdata_sz;
}
mpi_errno = NMPI_Type_get_true_extent(sendtype, &sendtype_true_lb, &true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
mpi_errno = NMPI_Type_get_true_extent(recvtype, &recvtype_true_lb, &true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(sendtype, &sendtype_true_lb, &true_extent);
MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &true_extent);
if (sendtype_iscontig && recvtype_iscontig)
{
......
......@@ -110,8 +110,7 @@ static int MPIR_Reduce_scatter_noncomm (
MPID_Datatype_get_extent_macro(datatype, extent);
/* assumes nesting is handled by the caller right now, may not be true in the future */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
is_commutative = 1;
......@@ -326,9 +325,7 @@ int MPIR_Reduce_scatter_intra (
MPIR_Nest_incr();
MPID_Datatype_get_extent_macro(datatype, extent);
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
is_commutative = 1;
......@@ -792,8 +789,11 @@ int MPIR_Reduce_scatter_intra (
for (j=my_tree_root; (j<my_tree_root+mask) && (j<comm_size); j++)
dis[1] += recvcnts[j];
NMPI_Type_indexed(2, blklens, dis, datatype, &sendtype);
NMPI_Type_commit(&sendtype);
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&sendtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* calculate recvtype */
blklens[0] = blklens[1] = 0;
......@@ -807,8 +807,11 @@ int MPIR_Reduce_scatter_intra (
for (j=dst_tree_root; (j<dst_tree_root+mask) && (j<comm_size); j++)
dis[1] += recvcnts[j];
NMPI_Type_indexed(2, blklens, dis, datatype, &recvtype);
NMPI_Type_commit(&recvtype);
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&recvtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
received = 0;
if (dst < comm_size) {
......@@ -939,8 +942,8 @@ int MPIR_Reduce_scatter_intra (
}
}
NMPI_Type_free(&sendtype);
NMPI_Type_free(&recvtype);
MPIR_Type_free_impl(&sendtype);
MPIR_Type_free_impl(&recvtype);
mask <<= 1;
i++;
......@@ -996,7 +999,6 @@ int MPIR_Reduce_scatter_inter (
int *disps=NULL;
MPID_Comm *newcomm_ptr = NULL;
MPIU_CHKLMEM_DECL(2);
MPIU_THREADPRIV_DECL;
rank = comm_ptr->rank;
local_size = comm_ptr->local_size;
......@@ -1016,13 +1018,7 @@ int MPIR_Reduce_scatter_inter (
total_count += recvcnts[i];
}
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
MPIR_Nest_decr();
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
......
......@@ -112,7 +112,7 @@ static int MPIR_Reduce_scatter_block_noncomm (
MPID_Datatype_get_extent_macro(datatype, extent);
/* assumes nesting is handled by the caller right now, may not be true in the future */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
is_commutative = 1;
......@@ -328,9 +328,7 @@ int MPIR_Reduce_scatter_block_intra (
}
MPID_Datatype_get_extent_macro(datatype, extent);
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
is_commutative = 1;
......@@ -771,8 +769,11 @@ int MPIR_Reduce_scatter_block_intra (
for (j=my_tree_root; (j<my_tree_root+mask) && (j<comm_size); j++)
dis[1] += recvcount;
NMPI_Type_indexed(2, blklens, dis, datatype, &sendtype);
NMPI_Type_commit(&sendtype);
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&sendtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
/* calculate recvtype */
blklens[0] = blklens[1] = 0;
......@@ -786,8 +787,11 @@ int MPIR_Reduce_scatter_block_intra (
for (j=dst_tree_root; (j<dst_tree_root+mask) && (j<comm_size); j++)
dis[1] += recvcount;
NMPI_Type_indexed(2, blklens, dis, datatype, &recvtype);
NMPI_Type_commit(&recvtype);
mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
mpi_errno = MPIR_Type_commit_impl(&recvtype);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
received = 0;
if (dst < comm_size) {
......@@ -918,8 +922,8 @@ int MPIR_Reduce_scatter_block_intra (
}
}
NMPI_Type_free(&sendtype);
NMPI_Type_free(&recvtype);
MPIR_Type_free_impl(&sendtype);
MPIR_Type_free_impl(&recvtype);
mask <<= 1;
i++;
......@@ -984,10 +988,7 @@ int MPIR_Reduce_scatter_block_inter (
/* In each group, rank 0 allocates a temp. buffer for the
reduce */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
MPIU_CHKLMEM_MALLOC(tmp_buf, void *, total_count*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
......
......@@ -67,8 +67,7 @@ static int MPIR_Reduce_binomial (
/* Create a temporary buffer */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
......@@ -307,8 +306,7 @@ static int MPIR_Reduce_redscat_gather (
/* Create a temporary buffer */
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
if (HANDLE_GET_KIND(op) == HANDLE_KIND_BUILTIN) {
......@@ -753,8 +751,7 @@ int MPIR_Reduce_intra (
/* Create a temporary buffer on local roots of all nodes */
if (comm_ptr->node_roots_comm != NULL) {
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
MPID_Ensure_Aint_fits_in_pointer(count * MPIR_MAX(extent, true_extent));
......@@ -928,9 +925,7 @@ int MPIR_Reduce_inter (
rank = comm_ptr->rank;
if (rank == 0) {
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
/* I think this is the worse case, so we can avoid an assert()
......
......@@ -127,11 +127,7 @@ static int MPIR_Scan_generic (
}
/* need to allocate temporary buffer to store partial scan*/
MPIR_Nest_incr();
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb,
&true_extent);
MPIR_Nest_decr();
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
MPIU_CHKLMEM_MALLOC(partial_scan, void *, count*(MPIR_MAX(extent,true_extent)), mpi_errno, "partial_scan");
......@@ -278,10 +274,7 @@ int MPIR_Scan(
}
MPIU_THREADPRIV_GET;
MPIR_Nest_incr();
mpi_errno = NMPI_Type_get_true_extent(datatype, &true_lb, &true_extent);
MPIR_Nest_decr();
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
MPIR_Type_get_true_extent_impl(datatype, &true_lb, &true_extent);
MPID_Datatype_get_extent_macro(datatype, extent);
......
......@@ -401,7 +401,6 @@ int MPIR_Scatter_inter (
MPID_Comm *newcomm_ptr = NULL;
MPI_Comm comm;
MPIU_CHKLMEM_DECL(1);
MPIU_THREADPRIV_DECL;
if (root == MPI_PROC_NULL) {