* under the terms of the license (GNU LGPL) which comes with this package. */
#include <simgrid/s4u/host.hpp>
-#include <src/smpi/smpi_group.hpp>
#include <xbt/ex.hpp>
#include "private.h"
} else if (ndims < 0 || (ndims > 0 && (dims == nullptr || periodic == nullptr)) || comm_cart == nullptr) {
return MPI_ERR_ARG;
} else{
- return smpi_mpi_cart_create(comm_old, ndims, dims, periodic, reorder, comm_cart);
+ new simgrid::SMPI::Cart(comm_old, ndims, dims, periodic, reorder, comm_cart);
+ return MPI_SUCCESS;
}
}
if (coords == nullptr) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cart_rank(comm, coords, rank);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ return topo->rank(coords, rank);
}
int PMPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
if (source == nullptr || dest == nullptr || direction < 0 ) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cart_shift(comm, direction, displ, source, dest);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ return topo->shift(direction, displ, source, dest);
}
int PMPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
if(coords == nullptr) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cart_coords(comm, rank, maxdims, coords);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ return topo->coords(rank, maxdims, coords);
}
int PMPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
if(maxdims <= 0 || dims == nullptr || periods == nullptr || coords == nullptr) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cart_get(comm, maxdims, dims, periods, coords);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ return topo->get(maxdims, dims, periods, coords);
}
int PMPI_Cartdim_get(MPI_Comm comm, int* ndims) {
if (ndims == nullptr) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cartdim_get(comm, ndims);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ return topo->dim_get(ndims);
}
int PMPI_Dims_create(int nnodes, int ndims, int* dims) {
if (ndims < 1 || nnodes < 1) {
return MPI_ERR_DIMS;
}
-
- return smpi_mpi_dims_create(nnodes, ndims, dims);
+ return simgrid::SMPI::Dims_create(nnodes, ndims, dims);
}
int PMPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
if (comm_new == nullptr) {
return MPI_ERR_ARG;
}
- return smpi_mpi_cart_sub(comm, remain_dims, comm_new);
+ simgrid::SMPI::Cart* topo = static_cast<simgrid::SMPI::Cart*>(comm->topo());
+ if (topo==nullptr) {
+ return MPI_ERR_ARG;
+ }
+ simgrid::SMPI::Cart* cart = topo->sub(remain_dims, comm_new);
+ if(cart==nullptr)
+ return MPI_ERR_ARG;
+ return MPI_SUCCESS;
}
int PMPI_Type_create_resized(MPI_Datatype oldtype,MPI_Aint lb, MPI_Aint extent, MPI_Datatype *newtype){