Group::Group(const Group* origin)
{
if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
- size_ = origin->size();
// FIXME: cheinrich: There is no such thing as an index any more; the two maps should be removed
index_to_rank_map_ = origin->index_to_rank_map_;
rank_to_actor_map_ = origin->rank_to_actor_map_;
void Group::set_mapping(s4u::Actor* actor, int rank)
{
- if (0 <= rank && rank < size_) {
+ if (0 <= rank && rank < size()) {
int index = actor->get_pid();
if ((unsigned)index >= index_to_rank_map_.size())
index_to_rank_map_.resize(index + 1, MPI_UNDEFINED);
s4u::Actor* Group::actor(int rank) const
{
- if (0 <= rank && rank < size_)
+ if (0 <= rank && rank < size())
return rank_to_actor_map_[rank];
else
return nullptr;
int result;
result = MPI_IDENT;
- if (size_ != group2->size()) {
+ if (size() != group2->size()) {
result = MPI_UNEQUAL;
} else {
- for (int i = 0; i < size_; i++) {
+ for (int i = 0; i < size(); i++) {
int rank = group2->rank(actor(i));
if (rank == MPI_UNDEFINED) {
result = MPI_UNEQUAL;
int Group::group_union(MPI_Group group2, MPI_Group* newgroup) const
{
- int size1 = size_;
+ int size1 = size();
int size2 = group2->size();
for (int i = 0; i < size2; i++) {
s4u::Actor* actor = group2->actor(i);
int Group::difference(MPI_Group group2, MPI_Group* newgroup) const
{
- int newsize = size_;
- int size2 = size_;
+ int newsize = size();
+ int size2 = size();
for (int i = 0; i < size2; i++) {
s4u::Actor* actor = this->actor(i);
int proc2 = group2->rank(actor);
int Group::excl(int n, const int* ranks, MPI_Group* newgroup) const
{
- int oldsize = size_;
+ int oldsize = size();
int newsize = oldsize - n;
*newgroup = new Group(newsize);
- std::vector<bool> to_exclude(size_, false);
+ std::vector<bool> to_exclude(size(), false);
for (int i = 0; i < n; i++)
to_exclude[ranks[i]] = true;
int j = 0;
{
std::vector<int> to_incl;
for (int i = 0; i < n; i++)
- for (int j = ranges[i][0]; j >= 0 && j < size_ && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
+ for (int j = ranges[i][0]; j >= 0 && j < size() && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
j += ranges[i][2])
to_incl.push_back(j);
int Group::range_excl(int n, int ranges[][3], MPI_Group* newgroup) const
{
- std::vector<bool> to_excl(size_, false);
- int newsize = size_;
+ std::vector<bool> to_excl(size(), false);
+ int newsize = size();
for (int i = 0; i < n; i++) {
- for (int j = ranges[i][0]; j >= 0 && j < size_ && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
+ for (int j = ranges[i][0]; j >= 0 && j < size() && is_rank_in_range(j, ranges[i][0], ranges[i][1]);
j += ranges[i][2]) {
to_excl[j] = true;
newsize--;
*newgroup = new Group(newsize);
int j = 0;
- for (int rank = 0; rank < size_; rank++) {
+ for (int rank = 0; rank < size(); rank++) {
if (not to_excl[rank]) {
s4u::Actor* actor = this->actor(rank);
(*newgroup)->set_mapping(actor, j);