Skip to content

Commit

Permalink
binding: use _large_impl suffix for internal large interface
Browse files Browse the repository at this point in the history
Unfortunately our fortran bindings uses _c_impl and _c to refer to C
versions of Fortran binding, causing conflicts with the large count
interface. Since it is easier to change the C bindings, we use
_large_impl to differentiate. I think it is more readable than _c suffix
anyway.
  • Loading branch information
hzhou committed Feb 18, 2021
1 parent 6c68762 commit 234db6d
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 66 deletions.
4 changes: 2 additions & 2 deletions maint/local_python/binding_c.py
Original file line number Diff line number Diff line change
Expand Up @@ -1083,7 +1083,7 @@ def push_impl_decl(func, impl_name=None):

if func['_map_type'] == "BIG":
# add suffix to differentiate
impl_name = re.sub(r'_impl$', '_c_impl', impl_name)
impl_name = re.sub(r'_impl$', '_large_impl', impl_name)

if func['_impl_param_list']:
params = ', '.join(func['_impl_param_list'])
Expand Down Expand Up @@ -1266,7 +1266,7 @@ def dump_body_impl(func, prefix='mpir'):

impl = func['name']
if func['_map_type'] == "BIG" and func['_poly_impl'] == "separate":
impl += '_c'
impl += '_large'
if prefix == 'mpid':
impl = re.sub(r'^MPIX?_', 'MPID_', impl)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ int MPIR_Allgatherv_inter_remote_gather_local_bcast(const void *sendbuf, MPI_Ain

newcomm_ptr = comm_ptr->local_comm;

mpi_errno = MPIR_Type_indexed_c_impl(remote_size, recvcounts, displs, recvtype, &newtype);
mpi_errno = MPIR_Type_indexed_large_impl(remote_size, recvcounts, displs, recvtype, &newtype);
MPIR_ERR_CHECK(mpi_errno);

mpi_errno = MPIR_Type_commit_impl(&newtype);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ int MPIR_Iallgatherv_inter_sched_remote_gather_local_bcast(const void *sendbuf,

newcomm_ptr = comm_ptr->local_comm;

mpi_errno = MPIR_Type_indexed_c_impl(remote_size, recvcounts, displs, recvtype, &newtype);
mpi_errno = MPIR_Type_indexed_large_impl(remote_size, recvcounts, displs, recvtype, &newtype);
MPIR_ERR_CHECK(mpi_errno);

mpi_errno = MPIR_Type_commit_impl(&newtype);
Expand Down
2 changes: 1 addition & 1 deletion src/mpi/coll/op/op_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ int MPIR_Op_create_impl(MPI_User_function * user_fn, int commute, MPIR_Op ** p_o
goto fn_exit;
}

int MPIR_Op_create_c_impl(MPI_User_function_c * user_fn, int commute, MPIR_Op ** p_op_ptr)
int MPIR_Op_create_large_impl(MPI_User_function_c * user_fn, int commute, MPIR_Op ** p_op_ptr)
{
return MPIR_Op_create_impl((void *) user_fn, commute, p_op_ptr);
}
Expand Down
18 changes: 9 additions & 9 deletions src/mpi/datatype/type_contents.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,11 @@ int MPIR_Type_get_contents_impl(MPI_Datatype datatype, int max_integers, int max
return mpi_errno;
}

int MPIR_Type_get_contents_c_impl(MPI_Datatype datatype, MPI_Aint max_integers,
MPI_Aint max_addresses, MPI_Aint max_counts,
MPI_Aint max_datatypes, int array_of_integers[],
MPI_Aint array_of_addresses[], MPI_Count array_of_counts[],
MPI_Datatype array_of_datatypes[])
int MPIR_Type_get_contents_large_impl(MPI_Datatype datatype, MPI_Aint max_integers,
MPI_Aint max_addresses, MPI_Aint max_counts,
MPI_Aint max_datatypes, int array_of_integers[],
MPI_Aint array_of_addresses[], MPI_Count array_of_counts[],
MPI_Datatype array_of_datatypes[])
{
int mpi_errno = MPI_SUCCESS;

Expand Down Expand Up @@ -158,10 +158,10 @@ int MPIR_Type_get_envelope_impl(MPI_Datatype datatype,
return mpi_errno;
}

int MPIR_Type_get_envelope_c_impl(MPI_Datatype datatype,
MPI_Aint * num_integers, MPI_Aint * num_addresses,
MPI_Aint * num_large_counts, MPI_Aint * num_datatypes,
int *combiner)
int MPIR_Type_get_envelope_large_impl(MPI_Datatype datatype,
MPI_Aint * num_integers, MPI_Aint * num_addresses,
MPI_Aint * num_large_counts, MPI_Aint * num_datatypes,
int *combiner)
{
MPIR_Type_get_envelope(datatype, num_integers, num_addresses, num_large_counts,
num_datatypes, combiner);
Expand Down
52 changes: 26 additions & 26 deletions src/mpi/datatype/type_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ int MPIR_Type_contiguous_impl(int count, MPI_Datatype oldtype, MPI_Datatype * ne
goto fn_exit;
}

int MPIR_Type_contiguous_c_impl(MPI_Aint count, MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_contiguous_large_impl(MPI_Aint count, MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPIR_Datatype *new_dtp;
Expand Down Expand Up @@ -428,8 +428,8 @@ int MPIR_Type_vector_impl(int count, int blocklength, int stride, MPI_Datatype o
goto fn_exit;
}

int MPIR_Type_vector_c_impl(MPI_Aint count, MPI_Aint blocklength, MPI_Aint stride,
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_vector_large_impl(MPI_Aint count, MPI_Aint blocklength, MPI_Aint stride,
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -484,8 +484,8 @@ int MPIR_Type_create_hvector_impl(int count, int blocklength, MPI_Aint stride,
goto fn_exit;
}

int MPIR_Type_create_hvector_c_impl(MPI_Aint count, MPI_Aint blocklength, MPI_Aint stride,
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_hvector_large_impl(MPI_Aint count, MPI_Aint blocklength, MPI_Aint stride,
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -560,9 +560,9 @@ int MPIR_Type_create_indexed_block_impl(int count,
goto fn_exit;
}

int MPIR_Type_create_indexed_block_c_impl(MPI_Aint count, MPI_Aint blocklength,
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_indexed_block_large_impl(MPI_Aint count, MPI_Aint blocklength,
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -627,9 +627,9 @@ int MPIR_Type_create_hindexed_block_impl(int count, int blocklength,
goto fn_exit;
}

int MPIR_Type_create_hindexed_block_c_impl(MPI_Aint count, MPI_Aint blocklength,
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_hindexed_block_large_impl(MPI_Aint count, MPI_Aint blocklength,
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -718,10 +718,10 @@ int MPIR_Type_indexed_impl(int count, const int *array_of_blocklengths,
goto fn_exit;
}

int MPIR_Type_indexed_c_impl(MPI_Aint count,
const MPI_Aint * array_of_blocklengths,
const MPI_Aint * array_of_displacements,
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_indexed_large_impl(MPI_Aint count,
const MPI_Aint * array_of_blocklengths,
const MPI_Aint * array_of_displacements,
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -805,10 +805,10 @@ int MPIR_Type_create_hindexed_impl(int count, const int array_of_blocklengths[],
goto fn_exit;
}

int MPIR_Type_create_hindexed_c_impl(MPI_Aint count,
const MPI_Aint array_of_blocklengths[],
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_hindexed_large_impl(MPI_Aint count,
const MPI_Aint array_of_blocklengths[],
const MPI_Aint array_of_displacements[],
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -842,10 +842,10 @@ int MPIR_Type_create_hindexed_c_impl(MPI_Aint count,
goto fn_exit;
}

int MPIR_Type_create_struct_c_impl(MPI_Aint count,
const MPI_Aint * array_of_blocklengths,
const MPI_Aint * array_of_displacements,
const MPI_Datatype * array_of_types, MPI_Datatype * newtype)
int MPIR_Type_create_struct_large_impl(MPI_Aint count,
const MPI_Aint * array_of_blocklengths,
const MPI_Aint * array_of_displacements,
const MPI_Datatype * array_of_types, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand Down Expand Up @@ -1004,8 +1004,8 @@ int MPIR_Type_create_resized_impl(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint ex
goto fn_exit;
}

int MPIR_Type_create_resized_c_impl(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent,
MPI_Datatype * newtype)
int MPIR_Type_create_resized_large_impl(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint extent,
MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;
MPI_Datatype new_handle;
Expand All @@ -1031,7 +1031,7 @@ int MPIR_Type_create_resized_c_impl(MPI_Datatype oldtype, MPI_Aint lb, MPI_Aint
goto fn_exit;
}

/* FIXME: replace this routine with MPIR_Type_contiguous_c_impl -- require yaksa large count support */
/* FIXME: replace this routine with MPIR_Type_contiguous_large_impl -- require yaksa large count support */
int MPIR_Type_contiguous_x_impl(MPI_Count count, MPI_Datatype oldtype, MPI_Datatype * newtype)
{
/* to make 'count' fit MPI-3 type processing routines (which take integer
Expand Down
9 changes: 5 additions & 4 deletions src/mpi/datatype/type_create_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,11 @@ int MPIR_Type_create_darray_impl(int size, int rank, int ndims,
goto fn_exit;
}

int MPIR_Type_create_darray_c_impl(int size, int rank, int ndims,
const MPI_Aint array_of_gsizes[], const int array_of_distribs[],
const int array_of_dargs[], const int array_of_psizes[],
int order, MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_darray_large_impl(int size, int rank, int ndims,
const MPI_Aint array_of_gsizes[],
const int array_of_distribs[], const int array_of_dargs[],
const int array_of_psizes[], int order, MPI_Datatype oldtype,
MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;

Expand Down
8 changes: 4 additions & 4 deletions src/mpi/datatype/type_create_subarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ int MPIR_Type_create_subarray_impl(int ndims, const int array_of_sizes[],
goto fn_exit;
}

int MPIR_Type_create_subarray_c_impl(int ndims, const MPI_Aint array_of_sizes[],
const MPI_Aint array_of_subsizes[],
const MPI_Aint array_of_starts[], int order,
MPI_Datatype oldtype, MPI_Datatype * newtype)
int MPIR_Type_create_subarray_large_impl(int ndims, const MPI_Aint array_of_sizes[],
const MPI_Aint array_of_subsizes[],
const MPI_Aint array_of_starts[], int order,
MPI_Datatype oldtype, MPI_Datatype * newtype)
{
int mpi_errno = MPI_SUCCESS;

Expand Down
16 changes: 8 additions & 8 deletions src/mpi/datatype/typerep/src/typerep_dataloop_darray.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ int MPII_Typerep_convert_darray(int size, int rank, int ndims, const MPI_Aint *
MPL_free(st_offsets);
MPL_free(coords);

mpi_errno = MPIR_Type_create_struct_c_impl(3, blklens, disps, types, newtype);
mpi_errno = MPIR_Type_create_struct_large_impl(3, blklens, disps, types, newtype);
MPIR_ERR_CHECK(mpi_errno);

MPIR_Type_free_impl(&type_new);
Expand Down Expand Up @@ -187,22 +187,22 @@ static int type_block(const MPI_Aint * array_of_gsizes, int dim, int ndims, int
stride = orig_extent;
if (order == MPI_ORDER_FORTRAN) {
if (dim == 0) {
mpi_errno = MPIR_Type_contiguous_c_impl(mysize, type_old, type_new);
mpi_errno = MPIR_Type_contiguous_large_impl(mysize, type_old, type_new);
MPIR_ERR_CHECK(mpi_errno);
} else {
for (int i = 0; i < dim; i++)
stride *= (MPI_Aint) (array_of_gsizes[i]);
mpi_errno = MPIR_Type_create_hvector_c_impl(mysize, 1, stride, type_old, type_new);
mpi_errno = MPIR_Type_create_hvector_large_impl(mysize, 1, stride, type_old, type_new);
MPIR_ERR_CHECK(mpi_errno);
}
} else {
if (dim == ndims - 1) {
mpi_errno = MPIR_Type_contiguous_c_impl(mysize, type_old, type_new);
mpi_errno = MPIR_Type_contiguous_large_impl(mysize, type_old, type_new);
MPIR_ERR_CHECK(mpi_errno);
} else {
for (int i = ndims - 1; i > dim; i--)
stride *= (MPI_Aint) (array_of_gsizes[i]);
mpi_errno = MPIR_Type_create_hvector_c_impl(mysize, 1, stride, type_old, type_new);
mpi_errno = MPIR_Type_create_hvector_large_impl(mysize, 1, stride, type_old, type_new);
MPIR_ERR_CHECK(mpi_errno);
}
}
Expand Down Expand Up @@ -262,7 +262,7 @@ static int type_cyclic(const MPI_Aint * array_of_gsizes, int dim, int ndims, int
for (int i = ndims - 1; i > dim; i--)
stride *= (MPI_Aint) (array_of_gsizes[i]);

mpi_errno = MPIR_Type_create_hvector_c_impl(count, blksize, stride, type_old, type_new);
mpi_errno = MPIR_Type_create_hvector_large_impl(count, blksize, stride, type_old, type_new);
MPIR_ERR_CHECK(mpi_errno);

if (rem) {
Expand All @@ -276,7 +276,7 @@ static int type_cyclic(const MPI_Aint * array_of_gsizes, int dim, int ndims, int
blklens[0] = 1;
blklens[1] = rem;

mpi_errno = MPIR_Type_create_struct_c_impl(2, blklens, disps, types, &type_tmp);
mpi_errno = MPIR_Type_create_struct_large_impl(2, blklens, disps, types, &type_tmp);
MPIR_ERR_CHECK(mpi_errno);

MPIR_Type_free_impl(type_new);
Expand All @@ -295,7 +295,7 @@ static int type_cyclic(const MPI_Aint * array_of_gsizes, int dim, int ndims, int
disps[2] = orig_extent * ((MPI_Aint) (array_of_gsizes[dim]));
blklens[0] = blklens[1] = blklens[2] = 1;

mpi_errno = MPIR_Type_create_struct_c_impl(3, blklens, disps, types, &type_tmp);
mpi_errno = MPIR_Type_create_struct_large_impl(3, blklens, disps, types, &type_tmp);
MPIR_ERR_CHECK(mpi_errno);

MPIR_Type_free_impl(type_new);
Expand Down
20 changes: 10 additions & 10 deletions src/mpi/datatype/typerep/src/typerep_dataloop_subarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ int MPII_Typerep_convert_subarray(int ndims, MPI_Aint * array_of_sizes,
if (order == MPI_ORDER_FORTRAN) {
/* dimension 0 changes fastest */
if (ndims == 1) {
mpi_errno = MPIR_Type_contiguous_c_impl(array_of_subsizes[0], oldtype, &tmp1);
mpi_errno = MPIR_Type_contiguous_large_impl(array_of_subsizes[0], oldtype, &tmp1);
MPIR_ERR_CHECK(mpi_errno);
} else {
mpi_errno = MPIR_Type_vector_c_impl(array_of_subsizes[1], array_of_subsizes[0],
array_of_sizes[0], oldtype, &tmp1);
mpi_errno = MPIR_Type_vector_large_impl(array_of_subsizes[1], array_of_subsizes[0],
array_of_sizes[0], oldtype, &tmp1);
MPIR_ERR_CHECK(mpi_errno);

size = (MPI_Aint) (array_of_sizes[0]) * extent;
for (i = 2; i < ndims; i++) {
size *= (MPI_Aint) (array_of_sizes[i - 1]);
mpi_errno =
MPIR_Type_create_hvector_c_impl(array_of_subsizes[i], 1, size, tmp1, &tmp2);
MPIR_Type_create_hvector_large_impl(array_of_subsizes[i], 1, size, tmp1, &tmp2);
MPIR_ERR_CHECK(mpi_errno);
MPIR_Type_free_impl(&tmp1);
tmp1 = tmp2;
Expand All @@ -51,19 +51,19 @@ int MPII_Typerep_convert_subarray(int ndims, MPI_Aint * array_of_sizes,
} else { /* order == MPI_ORDER_C */
/* dimension ndims-1 changes fastest */
if (ndims == 1) {
mpi_errno = MPIR_Type_contiguous_c_impl(array_of_subsizes[0], oldtype, &tmp1);
mpi_errno = MPIR_Type_contiguous_large_impl(array_of_subsizes[0], oldtype, &tmp1);
MPIR_ERR_CHECK(mpi_errno);
} else {
mpi_errno = MPIR_Type_vector_c_impl(array_of_subsizes[ndims - 2],
array_of_subsizes[ndims - 1],
array_of_sizes[ndims - 1], oldtype, &tmp1);
mpi_errno = MPIR_Type_vector_large_impl(array_of_subsizes[ndims - 2],
array_of_subsizes[ndims - 1],
array_of_sizes[ndims - 1], oldtype, &tmp1);
MPIR_ERR_CHECK(mpi_errno);

size = (MPI_Aint) (array_of_sizes[ndims - 1]) * extent;
for (i = ndims - 3; i >= 0; i--) {
size *= (MPI_Aint) (array_of_sizes[i + 1]);
mpi_errno =
MPIR_Type_create_hvector_c_impl(array_of_subsizes[i], 1, size, tmp1, &tmp2);
MPIR_Type_create_hvector_large_impl(array_of_subsizes[i], 1, size, tmp1, &tmp2);
MPIR_ERR_CHECK(mpi_errno);
MPIR_Type_free_impl(&tmp1);
tmp1 = tmp2;
Expand Down Expand Up @@ -91,7 +91,7 @@ int MPII_Typerep_convert_subarray(int ndims, MPI_Aint * array_of_sizes,
types[1] = tmp1;
types[2] = MPI_UB;

mpi_errno = MPIR_Type_create_struct_c_impl(3, blklens, disps, types, newtype);
mpi_errno = MPIR_Type_create_struct_large_impl(3, blklens, disps, types, newtype);
MPIR_ERR_CHECK(mpi_errno);

MPIR_Type_free_impl(&tmp1);
Expand Down

0 comments on commit 234db6d

Please sign in to comment.