X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f2c9678ae1fbcdc391c1aa62ca7f6ea7aa8b4bdd..04cb8833befbe07b6b94ff0cae98bc17b78724e3:/src/smpi/smpi_group.cpp diff --git a/src/smpi/smpi_group.cpp b/src/smpi/smpi_group.cpp index adb199d040..f12c5cfa7c 100644 --- a/src/smpi/smpi_group.cpp +++ b/src/smpi/smpi_group.cpp @@ -1,13 +1,14 @@ -/* Copyright (c) 2010, 2013-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-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. */ -#include "private.h" +#include "src/smpi/smpi_comm.hpp" +#include "src/smpi/smpi_group.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_group, smpi, "Logging specific to SMPI (group)"); - Group mpi_MPI_GROUP_EMPTY; + +simgrid::smpi::Group mpi_MPI_GROUP_EMPTY; MPI_Group MPI_GROUP_EMPTY=&mpi_MPI_GROUP_EMPTY; namespace simgrid{ @@ -23,22 +24,16 @@ Group::Group() Group::Group(int n) : size_(n) { - int i; 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++) { + for (int i = 0; i < size_; i++) { rank_to_index_map_[i] = MPI_UNDEFINED; } } Group::Group(MPI_Group origin) { - char *key; - char *ptr_rank; - xbt_dict_cursor_t cursor = nullptr; - - int i; if(origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) { @@ -46,10 +41,13 @@ Group::Group(MPI_Group origin) 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++) { + for (int i = 0; i < size_; i++) { rank_to_index_map_[i] = origin->rank_to_index_map_[i]; } + char* key; + char* ptr_rank; + xbt_dict_cursor_t cursor = nullptr; xbt_dict_foreach(origin->index_to_rank_map_, cursor, key, ptr_rank) { int * cp = static_cast(xbt_malloc(sizeof(int))); *cp=*reinterpret_cast(ptr_rank); @@ -129,13 +127,12 @@ int Group::compare(MPI_Group group2) int i; int index; int rank; - int sz; result = MPI_IDENT; if (size_ != group2->size()) { result = MPI_UNEQUAL; } else { - sz = group2->size(); + int sz = group2->size(); for (i = 0; i < sz; i++) { index = this->index(i); rank = group2->rank(index);