+int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ return MPI_ERR_TOPOLOGY;
+ }
+ if (rank < 0 || rank >= smpi_comm_size(comm)) {
+ return MPI_ERR_RANK;
+ }
+ if (maxdims <= 0) {
+ return MPI_ERR_ARG;
+ }
+ if(coords == NULL) {
+ return MPI_ERR_ARG;
+ }
+ return smpi_mpi_cart_coords(comm, rank, maxdims, coords);
+}
+
+int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
+ if(comm == NULL || smpi_comm_topo(comm) == NULL) {
+ return MPI_ERR_TOPOLOGY;
+ }
+ if(maxdims <= 0 || dims == NULL || periods == NULL || coords == NULL) {
+ return MPI_ERR_ARG;
+ }
+ return smpi_mpi_cart_get(comm, maxdims, dims, periods, coords);
+}
+
+int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
+ if (comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ return MPI_ERR_TOPOLOGY;
+ }
+ if (ndims == NULL) {
+ return MPI_ERR_ARG;
+ }
+ return smpi_mpi_cartdim_get(comm, ndims);
+}
+
+int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
+ if(dims == NULL) {
+ return MPI_ERR_ARG;
+ }
+ if (ndims < 1 || nnodes < 1) {
+ return MPI_ERR_DIMS;
+ }
+
+ return smpi_mpi_dims_create(nnodes, ndims, dims);
+}
+
+int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
+ if(comm == MPI_COMM_NULL || smpi_comm_topo(comm) == NULL) {
+ return MPI_ERR_TOPOLOGY;
+ }
+ if (comm_new == NULL) {
+ return MPI_ERR_ARG;
+ }
+ 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;
+}
+
+
+
+int PMPI_Win_create( void *base, MPI_Aint size, int disp_unit, MPI_Info info, MPI_Comm comm, MPI_Win *win){
+ int retval = 0;
+ smpi_bench_end();
+ if (comm == MPI_COMM_NULL) {
+ retval= MPI_ERR_COMM;
+ }else if ((base == NULL && size != 0)
+ || disp_unit <= 0 || size < 0 ){
+ retval= MPI_ERR_OTHER;
+ }else{
+ *win = smpi_mpi_win_create( base, size, disp_unit, info, comm);
+ retval = MPI_SUCCESS;
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
+int PMPI_Win_free( MPI_Win* win){
+ int retval = 0;
+ smpi_bench_end();
+ if (win == NULL || *win == MPI_WIN_NULL) {
+ retval = MPI_ERR_WIN;
+ }else{
+ retval=smpi_mpi_win_free(win);
+ }
+ smpi_bench_begin();
+ return retval;
+}
+
+int PMPI_Win_set_name(MPI_Win win, char * name)