#include "xbt/sysdep.h"
#include "smpi/smpi.h"
-#include "src/smpi/smpi_group.hpp"
#include "private.h"
#include <vector>
#include <math.h>
MPI_Group oldGroup;
int nranks;
- int rank = smpi_comm_rank(comm_old);
+ int rank = comm_old->rank();
int newSize = 1;
if(ndims != 0) {
return retval;
}
newCart = smpi_cart_topo_create(ndims);
- oldGroup = smpi_comm_group(comm_old);
+ oldGroup = comm_old->group();
newGroup = new simgrid::SMPI::Group(newSize);
for (int i = 0 ; i < newSize ; i++) {
newGroup->set_mapping(oldGroup->index(i), i);
rank = rank % nranks;
}
- *comm_cart = smpi_comm_new(newGroup, newCart);
+ *comm_cart = new simgrid::SMPI::Comm(newGroup, newCart);
} else {
if (rank == 0) {
newCart = smpi_cart_topo_create(ndims);
- *comm_cart = smpi_comm_new(new simgrid::SMPI::Group(smpi_comm_group(MPI_COMM_SELF)), newCart);
+ *comm_cart = new simgrid::SMPI::Comm(new simgrid::SMPI::Group(MPI_COMM_SELF->group()), newCart);
} else {
*comm_cart = MPI_COMM_NULL;
}
}
int smpi_mpi_cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm) {
- MPI_Topology oldTopo = smpi_comm_topo(comm);
+ MPI_Topology oldTopo = comm->topo();
int oldNDims = oldTopo->topo.cart->ndims;
int j = 0;
int *newDims = nullptr;
}
int smpi_mpi_cart_coords(MPI_Comm comm, int rank, int maxdims, int coords[]) {
- MPI_Topology topo = smpi_comm_topo(comm);
+ MPI_Topology topo = comm->topo();
int nnodes = topo->topo.cart->nnodes;
for (int i = 0; i< topo->topo.cart->ndims; i++ ) {
nnodes = nnodes / topo->topo.cart->dims[i];
}
int smpi_mpi_cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
- MPI_Topology topo = smpi_comm_topo(comm);
+ MPI_Topology topo = comm->topo();
int ndims=topo->topo.cart->ndims < maxdims ? topo->topo.cart->ndims : maxdims;
for(int i = 0 ; i < ndims ; i++) {
dims[i] = topo->topo.cart->dims[i];
}
int smpi_mpi_cart_rank(MPI_Comm comm, int* coords, int* rank) {
- MPI_Topology topo = smpi_comm_topo(comm);
+ MPI_Topology topo = comm->topo();
int ndims = topo->topo.cart->ndims;
int coord;
*rank = 0;
}
int smpi_mpi_cart_shift(MPI_Comm comm, int direction, int disp, int *rank_source, int *rank_dest) {
- MPI_Topology topo = smpi_comm_topo(comm);
+ MPI_Topology topo = comm->topo();
int position[topo->topo.cart->ndims];
if(topo->topo.cart->ndims == 0) {
return MPI_ERR_DIMS;
}
- smpi_mpi_cart_coords(comm, smpi_comm_rank(comm), topo->topo.cart->ndims, position);
+ smpi_mpi_cart_coords(comm, comm->rank(), topo->topo.cart->ndims, position);
position[direction] += disp;
if(position[direction] < 0 ||
}
int smpi_mpi_cartdim_get(MPI_Comm comm, int *ndims) {
- MPI_Topology topo = smpi_comm_topo(comm);
+ MPI_Topology topo = comm->topo();
*ndims = topo->topo.cart->ndims;
return MPI_SUCCESS;