int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, MPI_Aint * size) { int ret; Datatype type_ptr = *(Datatype*) mpi_handle_to_datatype(datatype); Comm * comm_ptr = mpi_handle_to_ptr(comm); ret = Pack_size(incount, type_ptr, comm_ptr, size); return ret; }
int MPI_Unpack(void * inbuf, int insize, int * position, void * outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) { int ret; Datatype type_ptr = *(Datatype*) mpi_handle_to_datatype(type); Comm * comm_ptr = mpi_handle_to_ptr(comm); ret = Unpack(inbuf, insize, position, outbuf, outcount, type_ptr, comm_ptr); return ret; }
/* 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 i; Datatype oldtypes_ptr[count]; Datatype * newtype_ptr; for (i = 0; i < count; i++) { oldtypes_ptr[i] = *(Datatype*) mpi_handle_to_datatype(oldtypes[i]); } mpi_alloc_handle(newtype, (void**) &newtype_ptr); return Type_struct(count, blocklens, displacements, oldtypes_ptr, newtype_ptr); }
/*******************************************************/ /* MPI_Type_contiguous. Create count copies of a type. * this creates arrays of the singleton arguments and use them to call * MPI_Type_struct() */ FC_FUNC( mpi_type_contiguous, MPI_TYPE_CONTIGUOUS ) (int *count, int *oldtype, int * newtype, int * ierr) { *ierr = MPI_Type_contiguous(*count, *oldtype, newtype); } int MPI_Type_contiguous(int count, MPI_Datatype old, MPI_Datatype * new) { int ret; Datatype old_ptr = *(Datatype*) mpi_handle_to_datatype(old); Datatype * new_ptr; mpi_alloc_handle(new, (void**) &new_ptr); return Type_contiguous(count, old_ptr, new_ptr); } int Type_contiguous(int count, Datatype oldtype, Datatype *newtype) { int i; int blocklengths[count]; Datatype oldtypes[count]; MPI_Aint offsets[count]; MPI_Aint extent;