Comm::Comm(){}
-Comm::Comm(MPI_Group group, MPI_Topology topo) : m_group(group), m_topo(topo)
+Comm::Comm(MPI_Group group, MPI_Topology topo) : group_(group), topo_(topo)
{
- m_refcount=1;
- m_topoType = MPI_INVALID_TOPO;
- m_intra_comm = MPI_COMM_NULL;
- m_leaders_comm = MPI_COMM_NULL;
- m_is_uniform=1;
- m_non_uniform_map = nullptr;
- m_leaders_map = nullptr;
- m_is_blocked=0;
- m_attributes=nullptr;
+ refcount_=1;
+ topoType_ = MPI_INVALID_TOPO;
+ intra_comm_ = MPI_COMM_NULL;
+ leaders_comm_ = MPI_COMM_NULL;
+ is_uniform_=1;
+ non_uniform_map_ = nullptr;
+ leaders_map_ = nullptr;
+ is_blocked_=0;
+ attributes_=nullptr;
}
void Comm::destroy()
{
- if (this == MPI_COMM_UNINITIALIZED)
+ if (this == MPI_COMM_UNINITIALIZED){
smpi_process_comm_world()->destroy();
- delete m_topo; // there's no use count on topos
+ return;
+ }
+ delete topo_; // there's no use count on topos
this->unuse();
}
(*newcomm) = new simgrid::smpi::Comm(cp, this->topo());
int ret = MPI_SUCCESS;
- if(m_attributes !=nullptr){
- (*newcomm)->m_attributes = xbt_dict_new_homogeneous(nullptr);
+ if(attributes_ !=nullptr){
+ (*newcomm)->attributes_ = xbt_dict_new_homogeneous(nullptr);
xbt_dict_cursor_t cursor = nullptr;
char* key;
int flag;
void* value_in;
void* value_out;
- xbt_dict_foreach (m_attributes, cursor, key, value_in) {
+ xbt_dict_foreach (attributes_, cursor, key, value_in) {
smpi_comm_key_elem elem =
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, key, sizeof(int)));
if (elem != nullptr && elem->copy_fn != MPI_NULL_COPY_FN) {
return ret;
}
if (flag)
- xbt_dict_set_ext((*newcomm)->m_attributes, key, sizeof(int), value_out, nullptr);
+ xbt_dict_set_ext((*newcomm)->attributes_, key, sizeof(int), value_out, nullptr);
}
}
}
{
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->group();
- return m_group;
+ return group_;
}
MPI_Topology Comm::topo() {
- return m_topo;
+ return topo_;
}
int Comm::size()
{
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->size();
- return m_group->size();
+ return group_->size();
}
int Comm::rank()
{
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->rank();
- return m_group->rank(smpi_process_index());
+ return group_->rank(smpi_process_index());
}
void Comm::get_name (char* name, int* len)
{
- if (this == MPI_COMM_UNINITIALIZED)
+ if (this == MPI_COMM_UNINITIALIZED){
smpi_process_comm_world()->get_name(name, len);
+ return;
+ }
if(this == MPI_COMM_WORLD) {
strncpy(name, "WORLD",5);
*len = 5;
}
void Comm::set_leaders_comm(MPI_Comm leaders){
- if (this == MPI_COMM_UNINITIALIZED)
+ if (this == MPI_COMM_UNINITIALIZED){
smpi_process_comm_world()->set_leaders_comm(leaders);
- m_leaders_comm=leaders;
+ return;
+ }
+ leaders_comm_=leaders;
}
void Comm::set_intra_comm(MPI_Comm leaders){
- m_intra_comm=leaders;
+ intra_comm_=leaders;
}
int* Comm::get_non_uniform_map(){
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->get_non_uniform_map();
- return m_non_uniform_map;
+ return non_uniform_map_;
}
int* Comm::get_leaders_map(){
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->get_leaders_map();
- return m_leaders_map;
+ return leaders_map_;
}
MPI_Comm Comm::get_leaders_comm(){
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->get_leaders_comm();
- return m_leaders_comm;
+ return leaders_comm_;
}
MPI_Comm Comm::get_intra_comm(){
if (this == MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD)
return smpi_process_get_comm_intra();
- else return m_intra_comm;
+ else return intra_comm_;
}
int Comm::is_uniform(){
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->is_uniform();
- return m_is_uniform;
+ return is_uniform_;
}
int Comm::is_blocked(){
if (this == MPI_COMM_UNINITIALIZED)
return smpi_process_comm_world()->is_blocked();
- return m_is_blocked;
+ return is_blocked_;
}
MPI_Comm Comm::split(int color, int key)
}
void Comm::use(){
- if (this == MPI_COMM_UNINITIALIZED)
+ if (this == MPI_COMM_UNINITIALIZED){
smpi_process_comm_world()->use();
- m_group->use();
- m_refcount++;
+ return;
+ }
+ group_->use();
+ refcount_++;
}
void Comm::cleanup_attributes(){
- if(m_attributes !=nullptr){
+ if(attributes_ !=nullptr){
xbt_dict_cursor_t cursor = nullptr;
char* key;
void* value;
int flag;
- xbt_dict_foreach (m_attributes, cursor, key, value) {
+ xbt_dict_foreach (attributes_, cursor, key, value) {
smpi_comm_key_elem elem = static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null(smpi_comm_keyvals, key));
if (elem != nullptr && elem->delete_fn != nullptr)
elem->delete_fn(this, atoi(key), value, &flag);
}
- xbt_dict_free(&m_attributes);
+ xbt_dict_free(&attributes_);
}
}
void Comm::cleanup_smp(){
- if (m_intra_comm != MPI_COMM_NULL)
- m_intra_comm->unuse();
- if (m_leaders_comm != MPI_COMM_NULL)
- m_leaders_comm->unuse();
- if (m_non_uniform_map != nullptr)
- xbt_free(m_non_uniform_map);
- if (m_leaders_map != nullptr)
- xbt_free(m_leaders_map);
+ if (intra_comm_ != MPI_COMM_NULL)
+ intra_comm_->unuse();
+ if (leaders_comm_ != MPI_COMM_NULL)
+ leaders_comm_->unuse();
+ if (non_uniform_map_ != nullptr)
+ xbt_free(non_uniform_map_);
+ if (leaders_map_ != nullptr)
+ xbt_free(leaders_map_);
}
void Comm::unuse(){
- if (this == MPI_COMM_UNINITIALIZED)
+ if (this == MPI_COMM_UNINITIALIZED){
smpi_process_comm_world()->unuse();
- m_refcount--;
- m_group->unuse();
+ return;
+ }
+ refcount_--;
+ group_->unuse();
- if(m_refcount==0){
+ if(refcount_==0){
this->cleanup_smp();
this->cleanup_attributes();
delete this;
smpi_switch_data_segment(smpi_process_index());
}
- if(m_leaders_map==nullptr){
- m_leaders_map= leaders_map;
+ if(leaders_map_==nullptr){
+ leaders_map_= leaders_map;
}else{
xbt_free(leaders_map);
}
for(i=0; i<comm_size; i++){
int already_done=0;
for(j=0;j<leader_group_size; j++){
- if(m_leaders_map[i]==leader_list[j]){
+ if(leaders_map_[i]==leader_list[j]){
already_done=1;
}
}
if(already_done==0){
- leader_list[leader_group_size]=m_leaders_map[i];
+ leader_list[leader_group_size]=leaders_map_[i];
leader_group_size++;
}
}
}
}
if(is_uniform==0 && this->is_uniform()!=0){
- m_non_uniform_map= non_uniform_map;
+ non_uniform_map_= non_uniform_map;
}else{
xbt_free(non_uniform_map);
}
- m_is_uniform=is_uniform;
+ is_uniform_=is_uniform;
}
- smpi_coll_tuned_bcast_mpich(&(m_is_uniform),1, MPI_INT, 0, comm_intra );
+ smpi_coll_tuned_bcast_mpich(&(is_uniform_),1, MPI_INT, 0, comm_intra );
if(smpi_privatize_global_variables){ //we need to switch as the called function may silently touch global variables
smpi_switch_data_segment(smpi_process_index());
if(MPI_COMM_WORLD==MPI_COMM_UNINITIALIZED || this==MPI_COMM_WORLD){
if(this->rank()==0){
- m_is_blocked=global_blocked;
+ is_blocked_=global_blocked;
}
}else{
- m_is_blocked=global_blocked;
+ is_blocked_=global_blocked;
}
xbt_free(leader_list);
return ret;
}
}
- if(m_attributes==nullptr)
+ if(attributes_==nullptr)
return MPI_ERR_ARG;
- xbt_dict_remove_ext(m_attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
+ xbt_dict_remove_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int));
return MPI_SUCCESS;
}
static_cast<smpi_comm_key_elem>(xbt_dict_get_or_null_ext(smpi_comm_keyvals, reinterpret_cast<const char*>(&keyval), sizeof(int)));
if(elem==nullptr)
return MPI_ERR_ARG;
- if(m_attributes==nullptr){
+ if(attributes_==nullptr){
*flag=0;
return MPI_SUCCESS;
}
try {
*static_cast<void**>(attr_value) =
- xbt_dict_get_ext(m_attributes, reinterpret_cast<const char*>(&keyval), sizeof(int));
+ xbt_dict_get_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int));
*flag=1;
}
catch (xbt_ex& ex) {
if(ret!=MPI_SUCCESS)
return ret;
}
- if(m_attributes==nullptr)
- m_attributes = xbt_dict_new_homogeneous(nullptr);
+ if(attributes_==nullptr)
+ attributes_ = xbt_dict_new_homogeneous(nullptr);
- xbt_dict_set_ext(m_attributes, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
+ xbt_dict_set_ext(attributes_, reinterpret_cast<const char*>(&keyval), sizeof(int), attr_value, nullptr);
return MPI_SUCCESS;
}
class Comm {
private:
- MPI_Group m_group;
- MPIR_Topo_type m_topoType;
- MPI_Topology m_topo; // to be replaced by an union
- int m_refcount;
- MPI_Comm m_leaders_comm;//inter-node communicator
- MPI_Comm m_intra_comm;//intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
+ MPI_Group group_;
+ MPIR_Topo_type topoType_;
+ MPI_Topology topo_; // to be replaced by an union
+ int refcount_;
+ MPI_Comm leaders_comm_;//inter-node communicator
+ MPI_Comm intra_comm_;//intra-node communicator . For MPI_COMM_WORLD this can't be used, as var is global.
//use an intracomm stored in the process data instead
- int* m_leaders_map; //who is the leader of each process
- int m_is_uniform;
- int* m_non_uniform_map; //set if smp nodes have a different number of processes allocated
- int m_is_blocked;// are ranks allocated on the same smp node contiguous ?
- xbt_dict_t m_attributes;
+ int* leaders_map_; //who is the leader of each process
+ int is_uniform_;
+ int* non_uniform_map_; //set if smp nodes have a different number of processes allocated
+ int is_blocked_;// are ranks allocated on the same smp node contiguous ?
+ xbt_dict_t attributes_;
public:
Comm();
Group::Group()
{
- m_size=0; /* size */
- m_rank_to_index_map=nullptr; /* m_rank_to_index_map */
- m_index_to_rank_map=nullptr; /* m_index_to_rank_map */
- m_refcount=1; /* m_refcount: start > 0 so that this group never gets freed */
+ size_=0; /* size */
+ rank_to_index_map_=nullptr; /* rank_to_index_map_ */
+ index_to_rank_map_=nullptr; /* index_to_rank_map_ */
+ refcount_=1; /* refcount_: start > 0 so that this group never gets freed */
}
-Group::Group(int n) : m_size(n)
+Group::Group(int n) : size_(n)
{
int i;
- m_rank_to_index_map = xbt_new(int, m_size);
- m_index_to_rank_map = xbt_dict_new_homogeneous(xbt_free_f);
- m_refcount = 1;
- for (i = 0; i < m_size; i++) {
- m_rank_to_index_map[i] = MPI_UNDEFINED;
+ rank_to_index_map_ = xbt_new(int, size_);
+ index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
+ refcount_ = 1;
+ for (i = 0; i < size_; i++) {
+ rank_to_index_map_[i] = MPI_UNDEFINED;
}
}
if(origin != MPI_GROUP_NULL
&& origin != MPI_GROUP_EMPTY)
{
- m_size = origin->size();
- m_rank_to_index_map = xbt_new(int, m_size);
- m_index_to_rank_map = xbt_dict_new_homogeneous(xbt_free_f);
- m_refcount = 1;
- for (i = 0; i < m_size; i++) {
- m_rank_to_index_map[i] = origin->m_rank_to_index_map[i];
+ size_ = origin->size();
+ rank_to_index_map_ = xbt_new(int, size_);
+ index_to_rank_map_ = xbt_dict_new_homogeneous(xbt_free_f);
+ refcount_ = 1;
+ for (i = 0; i < size_; i++) {
+ rank_to_index_map_[i] = origin->rank_to_index_map_[i];
}
- xbt_dict_foreach(origin->m_index_to_rank_map, cursor, key, ptr_rank) {
+ xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) {
int * cp = static_cast<int*>(xbt_malloc(sizeof(int)));
*cp=*reinterpret_cast<int*>(ptr_rank);
- xbt_dict_set(m_index_to_rank_map, key, cp, nullptr);
+ xbt_dict_set(index_to_rank_map_, key, cp, nullptr);
}
}
}
Group::~Group()
{
- xbt_free(m_rank_to_index_map);
- xbt_dict_free(&m_index_to_rank_map);
+ xbt_free(rank_to_index_map_);
+ xbt_dict_free(&index_to_rank_map_);
}
void Group::destroy()
{
int * val_rank;
- if (rank < m_size) {
- m_rank_to_index_map[rank] = index;
+ if (rank < size_) {
+ rank_to_index_map_[rank] = index;
if (index!=MPI_UNDEFINED ) {
val_rank = static_cast<int *>(xbt_malloc(sizeof(int)));
*val_rank = rank;
char * key = bprintf("%d", index);
- xbt_dict_set(m_index_to_rank_map, key, val_rank, nullptr);
+ xbt_dict_set(index_to_rank_map_, key, val_rank, nullptr);
xbt_free(key);
}
}
{
int index = MPI_UNDEFINED;
- if (0 <= rank && rank < m_size) {
- index = m_rank_to_index_map[rank];
+ if (0 <= rank && rank < size_) {
+ index = rank_to_index_map_[rank];
}
return index;
}
if (this==MPI_GROUP_EMPTY)
return MPI_UNDEFINED;
char * key = bprintf("%d", index);
- ptr_rank = static_cast<int*>(xbt_dict_get_or_null(m_index_to_rank_map, key));
+ ptr_rank = static_cast<int*>(xbt_dict_get_or_null(index_to_rank_map_, key));
xbt_free(key);
if (ptr_rank==nullptr)
int Group::use()
{
- m_refcount++;
- return m_refcount;
+ refcount_++;
+ return refcount_;
}
int Group::unuse()
{
- m_refcount--;
- if (m_refcount <= 0) {
+ refcount_--;
+ if (refcount_ <= 0) {
delete this;
return 0;
}
- return m_refcount;
+ return refcount_;
}
int Group::size()
{
- return m_size;
+ return size_;
}
int Group::compare(MPI_Group group2)
int sz;
result = MPI_IDENT;
- if (m_size != group2->size()) {
+ if (size_ != group2->size()) {
result = MPI_UNEQUAL;
} else {
sz = group2->size();
int index=0;
if (n == 0) {
*newgroup = MPI_GROUP_EMPTY;
- } else if (n == m_size) {
+ } else if (n == size_) {
*newgroup = this;
if(this!= MPI_COMM_WORLD->group()
&& this != MPI_COMM_SELF->group()
int Group::group_union(MPI_Group group2, MPI_Group* newgroup)
{
- int size1 = m_size;
+ int size1 = size_;
int size2 = group2->size();
for (int i = 0; i < size2; i++) {
int proc2 = group2->index(i);
int Group::difference(MPI_Group group2, MPI_Group* newgroup)
{
- int newsize = m_size;
- int size2 = m_size;
+ int newsize = size_;
+ int size2 = size_;
for (int i = 0; i < size2; i++) {
int proc1 = this->index(i);
int proc2 = group2->rank(proc1);
}
int Group::excl(int n, int *ranks, MPI_Group * newgroup){
- int oldsize = m_size;
+ int oldsize = size_;
int newsize = oldsize - n;
*newgroup = new simgrid::smpi::Group(newsize);
- int* to_exclude=xbt_new0(int, m_size);
+ int* to_exclude=xbt_new0(int, size_);
for (int i = 0; i < oldsize; i++)
to_exclude[i]=0;
for (int i = 0; i < n; i++)
int newsize = 0;
for (int i = 0; i < n; i++) {
for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < m_size; /* Last */
+ rank >= 0 && rank < size_; /* Last */
) {
newsize++;
if(rank == ranges[i][1]){/*already last ?*/
int j = 0;
for (int i = 0; i < n; i++) {
for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < m_size; /* Last */
+ rank >= 0 && rank < size_; /* Last */
) {
int index = this->index(rank);
(*newgroup)->set_mapping(index, j);
}
int Group::range_excl(int n, int ranges[][3], MPI_Group * newgroup){
- int newsize = m_size;
+ int newsize = size_;
for (int i = 0; i < n; i++) {
for (int rank = ranges[i][0]; /* First */
- rank >= 0 && rank < m_size; /* Last */
+ rank >= 0 && rank < size_; /* Last */
) {
newsize--;
if(rank == ranges[i][1]){/*already last ?*/
while (newrank < newsize) {
int add = 1;
for (int i = 0; i < n; i++) {
- for (int rank = ranges[i][0]; rank >= 0 && rank < m_size;) {
+ for (int rank = ranges[i][0]; rank >= 0 && rank < size_;) {
if(rank==oldrank){
add = 0;
break;
class Group {
private:
- int m_size;
- int *m_rank_to_index_map;
- xbt_dict_t m_index_to_rank_map;
- int m_refcount;
+ int size_;
+ int *rank_to_index_map_;
+ xbt_dict_t index_to_rank_map_;
+ int refcount_;
public:
Group();
Graph::~Graph()
{
- delete[] m_index;
- delete[] m_edges;
+ delete[] index_;
+ delete[] edges_;
}
Dist_Graph::~Dist_Graph()
{
- delete[] m_in;
- delete[] m_in_weights;
- delete[] m_out;
- delete[] m_out_weights;
+ delete[] in_;
+ delete[] in_weights_;
+ delete[] out_;
+ delete[] out_weights_;
}
/*******************************************************************************
******************************************************************************/
Cart::~Cart()
{
- delete[] m_dims;
- delete[] m_periodic;
- delete[] m_position;
+ delete[] dims_;
+ delete[] periodic_;
+ delete[] position_;
}
Cart::Cart(int ndims)
{
- m_nnodes = 0;
- m_ndims = ndims;
- m_dims = new int[ndims];
- m_periodic = new int[ndims];
- m_position = new int[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
newGroup->set_mapping(oldGroup->index(i), i);
}
- m_nnodes = newSize;
+ nnodes_ = newSize;
// FIXME : code duplication... See coords
nranks = newSize;
for (int i=0; i<ndims; i++) {
- m_dims[i] = dims[i];
- m_periodic[i] = periods[i];
+ dims_[i] = dims[i];
+ periodic_[i] = periods[i];
nranks = nranks / dims[i];
/* FIXME: nranks could be zero (?) */
- m_position[i] = rank / nranks;
+ position_[i] = rank / nranks;
rank = rank % nranks;
}
*comm_cart = MPI_COMM_NULL;
}
}
- m_comm=*comm_cart;
+ comm_=*comm_cart;
}
Cart* Cart::sub(const int remain_dims[], MPI_Comm *newcomm) {
- int oldNDims = m_ndims;
+ int oldNDims = ndims_;
int j = 0;
int *newDims = nullptr;
int *newPeriodic = nullptr;
// that should not segfault
for (int i = 0 ; j < newNDims ; i++) {
if(remain_dims[i]) {
- newDims[j] =m_dims[i];
- newPeriodic[j] =m_periodic[i];
+ newDims[j] =dims_[i];
+ newPeriodic[j] =periodic_[i];
j++;
}
}
}
- return new Cart(m_comm, newNDims, newDims, newPeriodic, 0, newcomm);
+ return new Cart(comm_, newNDims, newDims, newPeriodic, 0, newcomm);
}
int Cart::coords(int rank, int maxdims, int coords[]) {
- int nnodes = m_nnodes;
- for (int i = 0; i< m_ndims; i++ ) {
- nnodes = nnodes /m_dims[i];
+ int nnodes = nnodes_;
+ for (int i = 0; i< ndims_; i++ ) {
+ nnodes = nnodes /dims_[i];
coords[i] = rank / nnodes;
rank = rank % nnodes;
}
}
int Cart::get(int maxdims, int* dims, int* periods, int* coords) {
- int ndims=m_ndims < maxdims ?m_ndims : maxdims;
+ int ndims=ndims_ < maxdims ?ndims_ : maxdims;
for(int i = 0 ; i < ndims ; i++) {
- dims[i] =m_dims[i];
- periods[i] =m_periodic[i];
- coords[i] =m_position[i];
+ dims[i] =dims_[i];
+ periods[i] =periodic_[i];
+ coords[i] =position_[i];
}
return MPI_SUCCESS;
}
int Cart::rank(int* coords, int* rank) {
- int ndims =m_ndims;
+ int ndims =ndims_;
int coord;
*rank = 0;
int multiplier = 1;
/* The user can give us whatever coordinates he wants. If one of them is out of range, either this dimension is
* periodic, and we consider the equivalent coordinate inside the bounds, or it's not and then it's an error
*/
- if (coord >=m_dims[i]) {
- if (m_periodic[i] ) {
- coord = coord %m_dims[i];
+ if (coord >=dims_[i]) {
+ if (periodic_[i] ) {
+ coord = coord %dims_[i];
} else {
// Should I do that ?
*rank = -1;
return MPI_ERR_ARG;
}
} else if (coord < 0) {
- if(m_periodic[i]) {
- coord = coord %m_dims[i];
+ if(periodic_[i]) {
+ coord = coord %dims_[i];
if (coord)
- coord =m_dims[i] + coord;
+ coord =dims_[i] + coord;
} else {
*rank = -1;
return MPI_ERR_ARG;
}
*rank += multiplier * coord;
- multiplier *=m_dims[i];
+ multiplier *=dims_[i];
}
return MPI_SUCCESS;
}
int Cart::shift(int direction, int disp, int *rank_source, int *rank_dest) {
- int position[m_ndims];
+ int position[ndims_];
- if(m_ndims == 0) {
+ if(ndims_ == 0) {
return MPI_ERR_ARG;
}
- if (m_ndims < direction) {
+ if (ndims_ < direction) {
return MPI_ERR_DIMS;
}
- this->coords(m_comm->rank(),m_ndims, position);
+ this->coords(comm_->rank(),ndims_, position);
position[direction] += disp;
if(position[direction] < 0 ||
- position[direction] >=m_dims[direction]) {
- if(m_periodic[direction]) {
- position[direction] %=m_dims[direction];
+ position[direction] >=dims_[direction]) {
+ if(periodic_[direction]) {
+ position[direction] %=dims_[direction];
this->rank(position, rank_dest);
} else {
*rank_dest = MPI_PROC_NULL;
this->rank(position, rank_dest);
}
- position[direction] = m_position[direction] - disp;
- if(position[direction] < 0 || position[direction] >=m_dims[direction]) {
- if(m_periodic[direction]) {
- position[direction] %=m_dims[direction];
+ position[direction] = position_[direction] - disp;
+ if(position[direction] < 0 || position[direction] >=dims_[direction]) {
+ if(periodic_[direction]) {
+ position[direction] %=dims_[direction];
this->rank(position, rank_source);
} else {
*rank_source = MPI_PROC_NULL;
}
int Cart::dim_get(int *ndims) {
- *ndims =m_ndims;
+ *ndims =ndims_;
return MPI_SUCCESS;
}
class Topo {
protected:
- MPI_Comm m_comm;
+ MPI_Comm comm_;
};
class Cart: public Topo {
private:
- int m_nnodes;
- int m_ndims;
- int *m_dims;
- int *m_periodic;
- int *m_position;
+ int nnodes_;
+ int ndims_;
+ int *dims_;
+ int *periodic_;
+ int *position_;
public:
Cart(int ndims);
~Cart();
class Graph: public Topo {
private:
- int m_nnodes;
- int m_nedges;
- int *m_index;
- int *m_edges;
+ int nnodes_;
+ int nedges_;
+ int *index_;
+ int *edges_;
public:
Graph();
~Graph();
class Dist_Graph: public Topo {
private:
- int m_indegree;
- int *m_in;
- int *m_in_weights;
- int m_outdegree;
- int *m_out;
- int *m_out_weights;
- int m_is_weighted;
+ int indegree_;
+ int *in_;
+ int *in_weights_;
+ int outdegree_;
+ int *out_;
+ int *out_weights_;
+ int is_weighted_;
public:
Dist_Graph();
~Dist_Graph();