From: Augustin Degomme Date: Wed, 3 Mar 2021 11:54:33 +0000 (+0100) Subject: mpi_comm_self was cleaned after mpi finalization during actor deletion, which was... X-Git-Tag: v3.27~267 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2f03f13fefaaa547d3eaf5084d573976e4f4f765 mpi_comm_self was cleaned after mpi finalization during actor deletion, which was annoying (after leaks check). Have it done at MPI_Finalize level. --- diff --git a/src/smpi/internals/smpi_actor.cpp b/src/smpi/internals/smpi_actor.cpp index 0463493c9f..d97e4e1dc1 100644 --- a/src/smpi/internals/smpi_actor.cpp +++ b/src/smpi/internals/smpi_actor.cpp @@ -54,12 +54,6 @@ ActorExt::ActorExt(s4u::Actor* actor) : actor_(actor) ActorExt::~ActorExt() { - if (info_env_ != MPI_INFO_NULL) - simgrid::smpi::Info::unref(info_env_); - if (comm_self_ != MPI_COMM_NULL) - simgrid::smpi::Comm::destroy(comm_self_); - if (comm_intra_ != MPI_COMM_NULL) - simgrid::smpi::Comm::destroy(comm_intra_); xbt_os_timer_free(timer_); } @@ -68,7 +62,12 @@ void ActorExt::finalize() { state_ = SmpiProcessState::FINALIZED; XBT_DEBUG("<%ld> Process left the game", actor_->get_pid()); - + if (info_env_ != MPI_INFO_NULL) + simgrid::smpi::Info::unref(info_env_); + if (comm_self_ != MPI_COMM_NULL) + simgrid::smpi::Comm::destroy(comm_self_); + if (comm_intra_ != MPI_COMM_NULL) + simgrid::smpi::Comm::destroy(comm_intra_); smpi_deployment_unregister_process(instance_id_); } diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index 41590a20be..3ce4890ed2 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -586,7 +586,7 @@ void Comm::set_errhandler(MPI_Errhandler errhandler) simgrid::smpi::Errhandler::unref(errhandlers_[this->rank()]); errhandlers_[this->rank()]=errhandler; } - if (errhandler != MPI_ERRHANDLER_NULL && this != MPI_COMM_SELF) + if (errhandler != MPI_ERRHANDLER_NULL) errhandler->ref(); }