X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/f9d94fd3daa5f6293cf12b7f2837263c274c84b2..bfe330e022e921b71885949d75af1174cc8f32a3:/src/smpi/mpi/smpi_group.cpp diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index 029df2c3fa..76c752a011 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -37,7 +37,15 @@ void Group::set_mapping(s4u::Actor* actor, int rank) int Group::rank(aid_t pid) const { - return static_cast(pid) < pid_to_rank_map_.size() ? pid_to_rank_map_[pid] : MPI_UNDEFINED; + int res = static_cast(pid) < pid_to_rank_map_.size() ? pid_to_rank_map_[pid] : MPI_UNDEFINED; + if (res == MPI_UNDEFINED) { + // I'm not in the communicator ... but maybe my parent is? + if (auto parent = s4u::Actor::by_pid(pid)) { + aid_t ppid = parent->get_ppid(); + res = static_cast(ppid) < pid_to_rank_map_.size() ? pid_to_rank_map_[ppid] : MPI_UNDEFINED; + } + } + return res; } s4u::Actor* Group::actor(int rank) const