A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
In smpi::Group, 'index' is in fact a PID. Fix type and rename.
[simgrid.git]
/
src
/
smpi
/
mpi
/
smpi_group.cpp
diff --git
a/src/smpi/mpi/smpi_group.cpp
b/src/smpi/mpi/smpi_group.cpp
index
3e32408
..
029df2c
100644
(file)
--- a/
src/smpi/mpi/smpi_group.cpp
+++ b/
src/smpi/mpi/smpi_group.cpp
@@
-17,7
+17,7
@@
Group::Group(const Group* origin)
{
if (origin != MPI_GROUP_NULL && origin != MPI_GROUP_EMPTY) {
// 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_;
+
pid_to_rank_map_ = origin->pid
_to_rank_map_;
rank_to_actor_map_ = origin->rank_to_actor_map_;
actor_to_rank_map_ = origin->actor_to_rank_map_;
}
@@
-26,24
+26,18
@@
Group::Group(const Group* origin)
void Group::set_mapping(s4u::Actor* actor, int rank)
{
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);
-
index_to_rank_map_[index]
= rank;
+
aid_t pid
= actor->get_pid();
+ if (
static_cast<size_t>(pid) >= pid
_to_rank_map_.size())
+
pid_to_rank_map_.resize(pid
+ 1, MPI_UNDEFINED);
+
pid_to_rank_map_[pid]
= rank;
rank_to_actor_map_[rank] = actor;
actor_to_rank_map_.insert({actor, rank});
}
}
-int Group::rank(
int index
) const
+int Group::rank(
aid_t pid
) const
{
- int rank;
- if (0 <= index && (unsigned)index < index_to_rank_map_.size())
- rank = index_to_rank_map_[index];
- else
- rank = MPI_UNDEFINED;
-
- return rank;
+ return static_cast<size_t>(pid) < pid_to_rank_map_.size() ? pid_to_rank_map_[pid] : MPI_UNDEFINED;
}
s4u::Actor* Group::actor(int rank) const