class Op;
class Request;
class Topo;
+class Topo_Cart;
+class Topo_Graph;
+class Topo_Dist_Graph;
class Win;
-//TODO : rename these
-class Cart;
-class Graph;
-class Dist_Graph;
+
}
typedef simgrid::smpi::Op SMPI_Op;
typedef simgrid::smpi::Request SMPI_Request;
typedef simgrid::smpi::Topo SMPI_Topology;
+typedef simgrid::smpi::Topo_Cart SMPI_Cart_topology;
+typedef simgrid::smpi::Topo_Dist_Graph SMPI_Dist_Graph_topology;
+typedef simgrid::smpi::Topo_Graph SMPI_Graph_topology;
typedef simgrid::smpi::Win SMPI_Win;
-typedef simgrid::smpi::Graph SMPI_Graph_topology;
-typedef simgrid::smpi::Cart SMPI_Cart_topology;
-typedef simgrid::smpi::Dist_Graph SMPI_Dist_Graph_topology;
#else
} else if (ndims < 0 || (ndims > 0 && (dims == nullptr || periodic == nullptr)) || comm_cart == nullptr) {
return MPI_ERR_ARG;
} else{
- new Cart(comm_old, ndims, dims, periodic, reorder, comm_cart);
+ new Topo_Cart(comm_old, ndims, dims, periodic, reorder, comm_cart);
return MPI_SUCCESS;
}
}
if (coords == nullptr) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if (source == nullptr || dest == nullptr || direction < 0 ) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if(coords == nullptr) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if(maxdims <= 0 || dims == nullptr || periods == nullptr || coords == nullptr) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if (ndims == nullptr) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
if (comm_new == nullptr) {
return MPI_ERR_ARG;
}
- Cart* topo = static_cast<Cart*>(comm->topo());
+ MPIR_Cart_Topology topo = static_cast<MPIR_Cart_Topology>(comm->topo());
if (topo==nullptr) {
return MPI_ERR_ARG;
}
- Cart* cart = topo->sub(remain_dims, comm_new);
+ MPIR_Cart_Topology cart = topo->sub(remain_dims, comm_new);
if(cart==nullptr)
return MPI_ERR_ARG;
return MPI_SUCCESS;
namespace smpi{
-Graph::~Graph()
+Topo_Graph::~Topo_Graph()
{
delete[] index_;
delete[] edges_;
}
-Dist_Graph::~Dist_Graph()
+Topo_Dist_Graph::~Topo_Dist_Graph()
{
delete[] in_;
delete[] in_weights_;
/*******************************************************************************
* Cartesian topologies
******************************************************************************/
-Cart::~Cart()
+Topo_Cart::~Topo_Cart()
{
delete[] dims_;
delete[] periodic_;
delete[] position_;
}
-Cart::Cart(int ndims)
+Topo_Cart::Topo_Cart(int ndims)
{
nnodes_ = 0;
ndims_ = ndims;
/* reorder is ignored, don't know what would be the consequences of a dumb reordering but neither do I see the point of
* reordering*/
-Cart::Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart) : Cart(ndims) {
+Topo_Cart::Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart) : Topo_Cart(ndims) {
MPI_Group newGroup;
MPI_Group oldGroup;
int nranks;
comm_=*comm_cart;
}
-Cart* Cart::sub(const int remain_dims[], MPI_Comm *newcomm) {
+Topo_Cart* Topo_Cart::sub(const int remain_dims[], MPI_Comm *newcomm) {
int oldNDims = ndims_;
int j = 0;
int *newDims = nullptr;
}
}
}
- return new Cart(comm_, newNDims, newDims, newPeriodic, 0, newcomm);
+ return new Topo_Cart(comm_, newNDims, newDims, newPeriodic, 0, newcomm);
}
-int Cart::coords(int rank, int maxdims, int coords[]) {
+int Topo_Cart::coords(int rank, int maxdims, int coords[]) {
int nnodes = nnodes_;
for (int i = 0; i< ndims_; i++ ) {
nnodes = nnodes /dims_[i];
return MPI_SUCCESS;
}
-int Cart::get(int maxdims, int* dims, int* periods, int* coords) {
+int Topo_Cart::get(int maxdims, int* dims, int* periods, int* coords) {
int ndims=ndims_ < maxdims ?ndims_ : maxdims;
for(int i = 0 ; i < ndims ; i++) {
dims[i] =dims_[i];
return MPI_SUCCESS;
}
-int Cart::rank(int* coords, int* rank) {
+int Topo_Cart::rank(int* coords, int* rank) {
int ndims =ndims_;
int coord;
*rank = 0;
return MPI_SUCCESS;
}
-int Cart::shift(int direction, int disp, int *rank_source, int *rank_dest) {
+int Topo_Cart::shift(int direction, int disp, int *rank_source, int *rank_dest) {
int position[ndims_];
return MPI_SUCCESS;
}
-int Cart::dim_get(int *ndims) {
+int Topo_Cart::dim_get(int *ndims) {
*ndims =ndims_;
return MPI_SUCCESS;
}
};
-class Cart: public Topo {
+class Topo_Cart: public Topo {
private:
int nnodes_;
int ndims_;
int *periodic_;
int *position_;
public:
- Cart(int ndims);
- ~Cart();
- Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart);
- Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ;
+ Topo_Cart(int ndims);
+ ~Topo_Cart();
+ Topo_Cart(MPI_Comm comm_old, int ndims, int dims[], int periods[], int reorder, MPI_Comm *comm_cart);
+ Topo_Cart* sub(const int remain_dims[], MPI_Comm *newcomm) ;
int coords(int rank, int maxdims, int coords[]) ;
int get(int maxdims, int* dims, int* periods, int* coords);
int rank(int* coords, int* rank);
};
-class Graph: public Topo {
+class Topo_Graph: public Topo {
private:
int nnodes_;
int nedges_;
int *index_;
int *edges_;
public:
- Graph();
- ~Graph();
+ Topo_Graph();
+ ~Topo_Graph();
};
-class Dist_Graph: public Topo {
+class Topo_Dist_Graph: public Topo {
private:
int indegree_;
int *in_;
int *out_weights_;
int is_weighted_;
public:
- Dist_Graph();
- ~Dist_Graph();
+ Topo_Dist_Graph();
+ ~Topo_Dist_Graph();
};
/*