-/* Copyright (c) 2014, 2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2014-2017. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
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) : ndims_(ndims)
{
- nnodes_ = 0;
- ndims_ = ndims;
dims_ = new int[ndims];
periodic_ = new int[ndims];
position_ = new int[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;
return;
}
oldGroup = comm_old->group();
- newGroup = new simgrid::smpi::Group(newSize);
+ newGroup = new Group(newSize);
for (int i = 0 ; i < newSize ; i++) {
newGroup->set_mapping(oldGroup->index(i), i);
}
rank = rank % nranks;
}
- *comm_cart = new simgrid::smpi::Comm(newGroup, this);
+ *comm_cart = new Comm(newGroup, this);
} else {
if (rank == 0) {
- *comm_cart = new simgrid::smpi::Comm(new simgrid::smpi::Group(MPI_COMM_SELF->group()), this);
+ *comm_cart = new Comm(new Group(MPI_COMM_SELF->group()), this);
} else {
*comm_cart = MPI_COMM_NULL;
}
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;
}
/*
* This is a utility function, no need to have anything in the lower layer for this at all
*/
-int Dims_create(int nnodes, int ndims, int dims[])
+int Topo_Cart::Dims_create(int nnodes, int ndims, int dims[])
{
/* Get # of free-to-be-assigned processes and # of free dimensions */
int freeprocs = nnodes;