+
/* Copyright (c) 2007-2014. The SimGrid Team.
* All rights reserved. */
int PMPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periodic, int reorder, MPI_Comm* comm_cart) {
int retval = 0;
- smpi_bench_end();
if (comm_old == MPI_COMM_NULL){
- return MPI_ERR_COMM;
+ retval = MPI_ERR_COMM;
}
else if (ndims < 0 ||
(ndims > 0 && (dims == NULL ||
periodic == NULL)) ||
comm_cart == NULL) {
- return MPI_ERR_ARG;
+ retval = MPI_ERR_ARG;
}
retval = smpi_mpi_cart_create(comm_old, ndims, dims, periodic, reorder, comm_cart);
-
- smpi_bench_begin();
-
return retval;
}
return smpi_mpi_cart_sub(comm, remain_dims, comm_new);
}
+int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
+ if(oldtype == MPI_DATATYPE_NULL) {
+ return MPI_ERR_TYPE;
+ }
+ int blocks[3] = { 1, 1, 1 };
+ MPI_Aint disps[3] = { lb, 0, lb+extent };
+ MPI_Datatype types[3] = { MPI_LB, oldtype, MPI_UB };
+
+ s_smpi_mpi_struct_t* subtype = smpi_datatype_struct_create( blocks,
+ disps,
+ 3,
+ types
+ );
+ smpi_datatype_create(newtype,oldtype->size, lb, lb + extent, 1 , subtype, DT_FLAG_VECTOR);
+
+ (*newtype)->flags &= ~DT_FLAG_COMMITED;
+ return MPI_SUCCESS;
+}
+
/* The following calls are not yet implemented and will fail at runtime. */
/* Once implemented, please move them above this notice. */
return MPI_SUCCESS; \
}
-int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){
- NOT_YET_IMPLEMENTED
-}
-
int PMPI_Type_dup(MPI_Datatype datatype, MPI_Datatype *newtype){
NOT_YET_IMPLEMENTED
}