diff --git a/cart.c b/cart.c index ee8ea0b..f241ce8 100644 --- a/cart.c +++ b/cart.c @@ -17,7 +17,7 @@ int FC_FUNC( mpi_cart_create , MPI_CART_CREATE ) } -int MPI_Cart_create( MPI_Comm comm_old, int ndims, int *dims, int *periods, +int MPI_Cart_create( MPI_Comm comm_old, int ndims, const int dims[], const int periods[], int reorder, MPI_Comm *comm_cart) { int i; @@ -54,8 +54,8 @@ int FC_FUNC( mpi_cart_get , MPI_CART_GET ) } -int MPI_Cart_get(MPI_Comm comm, int maxdims, int *dims, - int *periods, int *coords) +int MPI_Cart_get(MPI_Comm comm, int maxdims, int dims[], + int periods[], int coords[]) { int i; for (i=0;ibuf=buf; + sreq->buf=(void*)buf; /* Explicit cast to suppress discarded-qualifiers warning */ sreq->tag=tag; sreq->complete=0; sreq->listitem=AP_list_append(mycomm->sendlist,sreq); @@ -107,7 +107,7 @@ int FC_FUNC(mpi_send, MPI_SEND) ( void *buf, int *count, int *datatype, -int MPI_Send(void* buf, int count, MPI_Datatype datatype, +int MPI_Send(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { MPI_Request request; @@ -140,7 +140,7 @@ int FC_FUNC(mpi_ssend, MPI_SSEND) ( void *buf, int *count, int *datatype, -int MPI_Ssend(void* buf, int count, MPI_Datatype datatype, +int MPI_Ssend(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { return(MPI_Send(buf,count,datatype,dest,tag,comm)); @@ -160,7 +160,7 @@ int FC_FUNC(mpi_rsend, MPI_RSEND) ( void *buf, int *count, int *datatype, -int MPI_Rsend(void* buf, int count, MPI_Datatype datatype, +int MPI_Rsend(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) { return(MPI_Send(buf,count,datatype,dest,tag,comm)); @@ -185,7 +185,7 @@ int FC_FUNC( mpi_irsend , MPI_IRSEND )(void *buf, int *count, int *datatype, -int MPI_Irsend(void *buf, int count, MPI_Datatype datatype, +int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request) { Req *req; @@ -230,7 +230,7 @@ int FC_FUNC(mpi_sendrecv, MPI_SENDRECV) ( -int MPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, +int MPI_Sendrecv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, int dest, int sendtag, void *recvbuf, int recvcount, MPI_Datatype recvtype, int source, int recvtag, diff --git a/type.c b/type.c index 4e7d661..ccdba3d 100644 --- a/type.c +++ b/type.c @@ -256,7 +256,7 @@ int Copy_type(typepair *source, typepair *dest) * All other type constructors call this function. */ -int Type_struct(int count, int * blocklens, MPI_Aint * displacements, +int Type_struct(int count, const int * blocklens, const MPI_Aint * displacements, Datatype *oldtypes_ptr, Datatype *newtype) { int i, j, k; @@ -400,8 +400,8 @@ int FC_FUNC( mpi_type_struct, MPI_TYPE_STRUCT ) /* Public function, wrapper for Type_struct that translates handle to * pointer (see NOTES at top of file) */ -int MPI_Type_struct(int count, int * blocklens, MPI_Aint * displacements, - MPI_Datatype *oldtypes, MPI_Datatype *newtype) +int MPI_Type_struct(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], + MPI_Datatype array_of_types[], MPI_Datatype *newtype) { int i; Datatype oldtypes_ptr[count]; @@ -409,12 +409,12 @@ int MPI_Type_struct(int count, int * blocklens, MPI_Aint * displacements, for (i = 0; i < count; i++) { - oldtypes_ptr[i] = *(Datatype*) mpi_handle_to_datatype(oldtypes[i]); + oldtypes_ptr[i] = *(Datatype*) mpi_handle_to_datatype(array_of_types[i]); } mpi_alloc_handle(newtype, (void**) &newtype_ptr); - return Type_struct(count, blocklens, displacements, + return Type_struct(count, array_of_blocklengths, array_of_displacements, oldtypes_ptr, newtype_ptr); } @@ -491,14 +491,14 @@ int FC_FUNC( mpi_type_hvector, MPI_TYPE_HVECTOR ) return MPI_SUCCESS; } -int MPI_Type_hvector(int count, int blocklen, MPI_Aint stride, +int MPI_Type_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); Datatype * new_ptr; mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_hvector(count, blocklen, stride, old_ptr, new_ptr); + return Type_hvector(count, blocklength, stride, old_ptr, new_ptr); } int FC_FUNC( mpi_type_create_hvector, MPI_TYPE_CREATE_HVECTOR ) @@ -509,14 +509,14 @@ int FC_FUNC( mpi_type_create_hvector, MPI_TYPE_CREATE_HVECTOR ) return MPI_SUCCESS; } -int MPI_Type_create_hvector(int count, int blocklen, MPI_Aint stride, +int MPI_Type_create_hvector(int count, int blocklength, MPI_Aint stride, MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); Datatype * new_ptr; mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_hvector(count, blocklen, stride, old_ptr, new_ptr); + return Type_hvector(count, blocklength, stride, old_ptr, new_ptr); } @@ -545,7 +545,7 @@ int FC_FUNC( mpi_type_vector, MPI_TYPE_VECTOR ) } -int MPI_Type_vector(int count, int blocklen, int stride, +int MPI_Type_vector(int count, int blocklength, int stride, MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); @@ -553,13 +553,13 @@ int MPI_Type_vector(int count, int blocklen, int stride, mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_vector(count, blocklen, stride, old_ptr, new_ptr); + return Type_vector(count, blocklength, stride, old_ptr, new_ptr); } /*******************************************************/ -int Type_hindexed(int count, int *blocklens, MPI_Aint *displacements, +int Type_hindexed(int count, const int *blocklens, const MPI_Aint *displacements, Datatype oldtype, Datatype *newtype) { int i; @@ -582,20 +582,20 @@ int FC_FUNC( mpi_type_hindexed, MPI_TYPE_HINDEXED ) return MPI_SUCCESS; } -int MPI_Type_hindexed(int count, int *blocklens, MPI_Aint * disps, +int MPI_Type_hindexed(int count, int array_of_blocklengths[], MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); Datatype * new_ptr; mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_hindexed(count, blocklens, disps, old_ptr, new_ptr); + return Type_hindexed(count, array_of_blocklengths, array_of_displacements, old_ptr, new_ptr); } /*******************************************************/ -int Type_indexed(int count, int *blocklens, int *displacements, +int Type_indexed(int count, const int *blocklens, const int *displacements, Datatype oldtype, Datatype *newtype) { int i; @@ -620,19 +620,19 @@ int FC_FUNC( mpi_type_indexed, MPI_TYPE_INDEXED ) } -int MPI_Type_indexed(int count, int *blocklens, int *displacements, +int MPI_Type_indexed(int count, const int array_of_blocklengths[], const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); Datatype * new_ptr; mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_indexed(count, blocklens, displacements, old_ptr, new_ptr); + return Type_indexed(count, array_of_blocklengths, array_of_displacements, old_ptr, new_ptr); } /*******************************************************/ -int Type_create_indexed_block(int count, int blocklen, int *displacements, +int Type_create_indexed_block(int count, int blocklen, const int *displacements, Datatype oldtype, Datatype *newtype) { int i; @@ -653,14 +653,14 @@ int FC_FUNC( mpi_type_create_indexed_block, MPI_TYPE_CREATE_INDEXED_BLOCK ) return MPI_SUCCESS; } -int MPI_Type_create_indexed_block(int count, int blocklen, int *displacements, +int MPI_Type_create_indexed_block(int count, int blocklength, const int array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype * newtype) { Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(oldtype); Datatype * new_ptr; mpi_alloc_handle(newtype, (void**) &new_ptr); - return Type_create_indexed_block(count, blocklen, displacements, old_ptr, new_ptr); + return Type_create_indexed_block(count, blocklength, array_of_displacements, old_ptr, new_ptr); } /*******************************************************/ @@ -725,11 +725,11 @@ int FC_FUNC( mpi_type_lb, MPI_TYPE_LB )(int * type, MPI_Aint * lb, int * ierr) return MPI_SUCCESS; } -int MPI_Type_lb(MPI_Datatype type, MPI_Aint * lb) +int MPI_Type_lb(MPI_Datatype type, MPI_Aint *displacement) { Datatype type_ptr = *(Datatype*) mpi_handle_to_datatype(type); - return Type_lb(type_ptr, lb); + return Type_lb(type_ptr, displacement); } /* MPI_Type_ub: Return upper bound (which may be overridden @@ -747,11 +747,11 @@ int FC_FUNC( mpi_type_ub, MPI_TYPE_UB )(int * type, MPI_Aint * ub, int * ierr) return MPI_SUCCESS; } -int MPI_Type_ub(MPI_Datatype type, MPI_Aint * ub) +int MPI_Type_ub(MPI_Datatype type, MPI_Aint *displacement) { Datatype type_ptr = *(Datatype*) mpi_handle_to_datatype(type); - return Type_ub(type_ptr, ub); + return Type_ub(type_ptr, displacement); } /* MPI_Get_address diff --git a/type.h b/type.h index 41847af..8365b72 100644 --- a/type.h +++ b/type.h @@ -118,9 +118,9 @@ int print_typemap(MPI_Datatype in); const extern Datatype simpletypes[]; Datatype* mpi_handle_to_datatype(int handle); -extern int Unpack(void * inbuf, int insize, int * position, void *outbuf, +extern int Unpack(const void * inbuf, int insize, int * position, void *outbuf, int outcount, Datatype type, Comm* comm); -extern int Pack(void *inbuf, int incount, Datatype type, +extern int Pack(const void *inbuf, int incount, Datatype type, void *outbuf, int outsize, int *position, Comm * comm); // added to avoid implicit declaration error (GCC-14) @@ -131,17 +131,17 @@ extern int MPI_Get_address(void * loc, MPI_Aint * address); extern int Pack_size(int incount, Datatype datatype, Comm * comm, MPI_Aint * size); extern int Type_contiguous(int count, Datatype oldtype, Datatype *newtype); -extern int Type_create_indexed_block(int count, int blocklen, int *displacements, +extern int Type_create_indexed_block(int count, int blocklen, const int *displacements, Datatype oldtype, Datatype *newtype); -extern int Type_hindexed(int count, int *blocklens, MPI_Aint *displacements, +extern int Type_hindexed(int count, const int *blocklens, const MPI_Aint *displacements, Datatype oldtype, Datatype *newtype); extern int Type_hvector(int count, int blocklen, MPI_Aint stride, Datatype oldtype, Datatype *newtype); -extern int Type_indexed(int count, int *blocklens, int *displacements, +extern int Type_indexed(int count, const int *blocklens, const int *displacements, Datatype oldtype, Datatype *newtype); extern int Type_lb(Datatype type, MPI_Aint * lb); extern int Type_size(Datatype type, int * size); -extern int Type_struct(int count, int * blocklens, MPI_Aint * displacements, +extern int Type_struct(int count, const int * blocklens, const MPI_Aint * displacements, Datatype *oldtypes_ptr, Datatype *newtype); extern int Type_ub(Datatype type, MPI_Aint * ub); extern int Type_vector(int count, int blocklen, int stride,