From f807f3ecd43bd280674b57f277d3af275fbfbaa5 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Sun, 18 Apr 2021 19:01:49 +0200 Subject: [PATCH] Kill smpi::Group::actor(int). --- src/smpi/bindings/smpi_pmpi.cpp | 8 ++-- src/smpi/bindings/smpi_pmpi_group.cpp | 2 +- src/smpi/bindings/smpi_pmpi_request.cpp | 6 +-- src/smpi/bindings/smpi_pmpi_win.cpp | 4 +- src/smpi/include/smpi_group.hpp | 7 +-- src/smpi/internals/smpi_replay.cpp | 15 +++--- src/smpi/mpi/smpi_comm.cpp | 4 +- src/smpi/mpi/smpi_group.cpp | 11 ----- src/smpi/mpi/smpi_request.cpp | 62 +++++++++++++------------ src/smpi/mpi/smpi_win.cpp | 13 +++--- 10 files changed, 58 insertions(+), 74 deletions(-) diff --git a/src/smpi/bindings/smpi_pmpi.cpp b/src/smpi/bindings/smpi_pmpi.cpp index eb5d4d3323..744b0a37a9 100644 --- a/src/smpi/bindings/smpi_pmpi.cpp +++ b/src/smpi/bindings/smpi_pmpi.cpp @@ -129,14 +129,14 @@ int PMPI_Abort(MPI_Comm comm, int /*errorcode*/) smpi_bench_end(); CHECK_COMM(1) XBT_WARN("MPI_Abort was called, something went probably wrong in this simulation ! Killing all processes sharing the same MPI_COMM_WORLD"); + smx_actor_t myself = SIMIX_process_self(); for (int i = 0; i < comm->size(); i++){ - smx_actor_t actor = comm->group()->actor(i)->get_impl(); - if(actor != SIMIX_process_self()) + smx_actor_t actor = simgrid::kernel::actor::ActorImpl::by_pid(comm->group()->actor_pid(i)); + if (actor != nullptr && actor != myself) simgrid::kernel::actor::simcall([actor] { actor->exit(); }); } // now ourself - smx_actor_t actor = SIMIX_process_self(); - simgrid::kernel::actor::simcall([actor] { actor->exit(); }); + simgrid::kernel::actor::simcall([myself] { myself->exit(); }); return MPI_SUCCESS; } diff --git a/src/smpi/bindings/smpi_pmpi_group.cpp b/src/smpi/bindings/smpi_pmpi_group.cpp index eb8a2d71f0..09200e0871 100644 --- a/src/smpi/bindings/smpi_pmpi_group.cpp +++ b/src/smpi/bindings/smpi_pmpi_group.cpp @@ -55,7 +55,7 @@ int PMPI_Group_translate_ranks(MPI_Group group1, int n, const int *ranks1, MPI_G if(ranks1[i]==MPI_PROC_NULL){ ranks2[i]=MPI_PROC_NULL; }else{ - simgrid::s4u::Actor* actor = group1->actor(ranks1[i]); + aid_t actor = group1->actor_pid(ranks1[i]); ranks2[i] = group2->rank(actor); } } diff --git a/src/smpi/bindings/smpi_pmpi_request.cpp b/src/smpi/bindings/smpi_pmpi_request.cpp index 5fa62ffebb..33fb033b8b 100644 --- a/src/smpi/bindings/smpi_pmpi_request.cpp +++ b/src/smpi/bindings/smpi_pmpi_request.cpp @@ -11,11 +11,9 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi); -static int getPid(MPI_Comm, int); static int getPid(MPI_Comm comm, int id) { - simgrid::s4u::ActorPtr actor = comm->group()->actor(id); - return (actor == nullptr) ? MPI_UNDEFINED : actor->get_pid(); + return comm->group()->actor_pid(id); } #define CHECK_SEND_INPUTS\ @@ -604,7 +602,7 @@ static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status) int dst_traced = req->dst(); // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE) if (src_traced == MPI_ANY_SOURCE && status != MPI_STATUS_IGNORE) - src_traced = req->comm()->group()->actor(status->MPI_SOURCE)->get_pid(); + src_traced = req->comm()->group()->actor_pid(status->MPI_SOURCE); TRACE_smpi_recv(src_traced, dst_traced, req->tag()); } } diff --git a/src/smpi/bindings/smpi_pmpi_win.cpp b/src/smpi/bindings/smpi_pmpi_win.cpp index 64bc6c00a6..8c2cb9a9ad 100644 --- a/src/smpi/bindings/smpi_pmpi_win.cpp +++ b/src/smpi/bindings/smpi_pmpi_win.cpp @@ -227,7 +227,7 @@ int PMPI_Put(const void *origin_addr, int origin_count, MPI_Datatype origin_data int my_proc_id = simgrid::s4u::this_actor::get_pid(); MPI_Group group; win->get_group(&group); - int dst_traced = group->actor(target_rank)->get_pid(); + int dst_traced = group->actor_pid(target_rank); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData("Put", target_rank, origin_datatype->is_replayable() ? origin_count @@ -258,7 +258,7 @@ int PMPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype origin_dat int my_proc_id = simgrid::s4u::this_actor::get_pid(); MPI_Group group; win->get_group(&group); - int dst_traced = group->actor(target_rank)->get_pid(); + int dst_traced = group->actor_pid(target_rank); TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::Pt2PtTIData( "Rput", target_rank, diff --git a/src/smpi/include/smpi_group.hpp b/src/smpi/include/smpi_group.hpp index f617b065d6..d6538120ed 100644 --- a/src/smpi/include/smpi_group.hpp +++ b/src/smpi/include/smpi_group.hpp @@ -19,7 +19,6 @@ class Group : public F2C{ /* This is actually a map from int to s4u::Actor*. We could use std::map here, but looking up a value there costs * O(log(n)). For a vector, this costs O(1). We hence go with the vector. */ - std::vector rank_to_actor_map_; std::map actor_to_rank_map_; std::vector rank_to_pid_map_; std::vector pid_to_rank_map_; @@ -31,16 +30,12 @@ class Group : public F2C{ public: Group() = default; - explicit Group(int size) - : rank_to_actor_map_(size, nullptr), rank_to_pid_map_(size, -1), pid_to_rank_map_(size, MPI_UNDEFINED) - { - } + explicit Group(int size) : rank_to_pid_map_(size, -1), pid_to_rank_map_(size, MPI_UNDEFINED) {} explicit Group(const Group* origin); void set_mapping(aid_t pid, int rank); int rank(aid_t pid) const; aid_t actor_pid(int rank) const; - s4u::Actor* actor(int rank) const; std::string name() const override {return std::string("MPI_Group");} int rank(s4u::Actor* process) const; void ref(); diff --git a/src/smpi/internals/smpi_replay.cpp b/src/smpi/internals/smpi_replay.cpp index f9f66f4d36..dfec134f00 100644 --- a/src/smpi/internals/smpi_replay.cpp +++ b/src/smpi/internals/smpi_replay.cpp @@ -128,10 +128,9 @@ public: /* Sometimes we need to re-insert MPI_REQUEST_NULL but we still need src,dst and tag */ void addNullRequest(int src, int dst, int tag) { - store.insert({req_key_t( - MPI_COMM_WORLD->group()->actor(src)->get_pid()-1, - MPI_COMM_WORLD->group()->actor(dst)->get_pid()-1, - tag), MPI_REQUEST_NULL}); + store.insert( + {req_key_t(MPI_COMM_WORLD->group()->actor_pid(src) - 1, MPI_COMM_WORLD->group()->actor_pid(dst) - 1, tag), + MPI_REQUEST_NULL}); } }; @@ -434,7 +433,7 @@ void WaitAction::kernel(simgrid::xbt::ReplayAction& action) void SendAction::kernel(simgrid::xbt::ReplayAction&) { const SendRecvParser& args = get_args(); - int dst_traced = MPI_COMM_WORLD->group()->actor(args.partner)->get_pid(); + int dst_traced = MPI_COMM_WORLD->group()->actor_pid(args.partner); TRACE_smpi_comm_in( get_pid(), __func__, @@ -482,7 +481,7 @@ void RecvAction::kernel(simgrid::xbt::ReplayAction&) TRACE_smpi_comm_out(get_pid()); if (is_recv && not TRACE_smpi_view_internals()) { - int src_traced = MPI_COMM_WORLD->group()->actor(status.MPI_SOURCE)->get_pid(); + int src_traced = MPI_COMM_WORLD->group()->actor_pid(status.MPI_SOURCE); TRACE_smpi_recv(src_traced, get_pid(), args.tag); } } @@ -588,7 +587,7 @@ void BcastAction::kernel(simgrid::xbt::ReplayAction&) { const BcastArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_bcast", - new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(), -1.0, + new simgrid::instr::CollTIData("bcast", MPI_COMM_WORLD->group()->actor_pid(args.root), -1.0, args.size, -1, Datatype::encode(args.datatype1), "")); colls::bcast(send_buffer(args.size * args.datatype1->size()), args.size, args.datatype1, args.root, MPI_COMM_WORLD); @@ -600,7 +599,7 @@ void ReduceAction::kernel(simgrid::xbt::ReplayAction&) { const ReduceArgParser& args = get_args(); TRACE_smpi_comm_in(get_pid(), "action_reduce", - new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor(args.root)->get_pid(), + new simgrid::instr::CollTIData("reduce", MPI_COMM_WORLD->group()->actor_pid(args.root), args.comp_size, args.comm_size, -1, Datatype::encode(args.datatype1), "")); diff --git a/src/smpi/mpi/smpi_comm.cpp b/src/smpi/mpi/smpi_comm.cpp index f5c264717e..81852a536e 100644 --- a/src/smpi/mpi/smpi_comm.cpp +++ b/src/smpi/mpi/smpi_comm.cpp @@ -501,9 +501,9 @@ void Comm::init_smp(){ } // Are the ranks blocked ? = allocated contiguously on the SMP nodes int is_blocked=1; - int prev=this->group()->rank(comm_intra->group()->actor(0)); + int prev = this->group()->rank(comm_intra->group()->actor_pid(0)); for (i = 1; i < my_local_size; i++) { - int that = this->group()->rank(comm_intra->group()->actor(i)); + int that = this->group()->rank(comm_intra->group()->actor_pid(i)); if (that != prev + 1) { is_blocked = 0; break; diff --git a/src/smpi/mpi/smpi_group.cpp b/src/smpi/mpi/smpi_group.cpp index b199d122a1..cda925b905 100644 --- a/src/smpi/mpi/smpi_group.cpp +++ b/src/smpi/mpi/smpi_group.cpp @@ -19,7 +19,6 @@ Group::Group(const Group* origin) // FIXME: cheinrich: There is no such thing as an index any more; the two maps should be removed rank_to_pid_map_ = origin->rank_to_pid_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_; } } @@ -32,7 +31,6 @@ void Group::set_mapping(aid_t pid, int rank) rank_to_pid_map_[rank] = pid; pid_to_rank_map_[pid] = rank; s4u::Actor* actor = s4u::Actor::by_pid(pid).get(); - rank_to_actor_map_[rank] = actor; actor_to_rank_map_.insert({actor, rank}); } } @@ -55,15 +53,6 @@ aid_t Group::actor_pid(int rank) const return (0 <= rank && rank < size()) ? rank_to_pid_map_[rank] : -1; } -s4u::Actor* Group::actor(int rank) const -{ - s4u::Actor* actor = (0 <= rank && rank < size()) ? rank_to_actor_map_[rank] : nullptr; - aid_t pid = actor_pid(rank); - xbt_assert(actor == nullptr || pid == actor->get_pid(), "pid = %ld, actor->get_pid() = %ld", pid, actor->get_pid()); - xbt_assert(actor != nullptr || pid == -1, "pid = %ld", pid); - return actor; -} - int Group::rank(s4u::Actor* actor) const { auto iterator = actor_to_rank_map_.find(actor); diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index c33b284af6..ec43755892 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -180,28 +180,28 @@ void Request::print_request(const char* message) const MPI_Request Request::bsend_init(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_SEND | MPI_REQ_PREPARED | MPI_REQ_BSEND); } MPI_Request Request::send_init(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_SEND | MPI_REQ_PREPARED); } MPI_Request Request::ssend_init(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_SSEND | MPI_REQ_SEND | MPI_REQ_PREPARED); } MPI_Request Request::isend_init(const void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) { return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SEND | MPI_REQ_PREPARED); } @@ -211,14 +211,15 @@ MPI_Request Request::rma_send_init(const void *buf, int count, MPI_Datatype data { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ if(op==MPI_OP_NULL){ - request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor_pid(src), + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_RMA | MPI_REQ_NON_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SEND | MPI_REQ_PREPARED); }else{ - request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor(src)->get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, comm->group()->actor_pid(src), + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_RMA | MPI_REQ_NON_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SEND | MPI_REQ_PREPARED | - MPI_REQ_ACCUMULATE, op); + MPI_REQ_ACCUMULATE, + op); } return request; } @@ -229,7 +230,7 @@ MPI_Request Request::recv_init(void *buf, int count, MPI_Datatype datatype, int if (src == MPI_ANY_SOURCE) source = MPI_ANY_SOURCE; else if (src != MPI_PROC_NULL) - source = comm->group()->actor(src)->get_pid(); + source = comm->group()->actor_pid(src); return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, simgrid::s4u::this_actor::get_pid(), tag, comm, @@ -244,15 +245,16 @@ MPI_Request Request::rma_recv_init(void *buf, int count, MPI_Datatype datatype, if (src == MPI_ANY_SOURCE) source = MPI_ANY_SOURCE; else if (src != MPI_PROC_NULL) - source = comm->group()->actor(src)->get_pid(); + source = comm->group()->actor_pid(src); if(op==MPI_OP_NULL){ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_RMA | MPI_REQ_NON_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PREPARED); }else{ - request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, - MPI_REQ_RMA | MPI_REQ_NON_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PREPARED | MPI_REQ_ACCUMULATE, op); + request = + new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, + MPI_REQ_RMA | MPI_REQ_NON_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PREPARED | MPI_REQ_ACCUMULATE, op); } return request; } @@ -263,7 +265,7 @@ MPI_Request Request::irecv_init(void *buf, int count, MPI_Datatype datatype, int if (src == MPI_ANY_SOURCE) source = MPI_ANY_SOURCE; else if (src != MPI_PROC_NULL) - source = comm->group()->actor(src)->get_pid(); + source = comm->group()->actor_pid(src); return new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, simgrid::s4u::this_actor::get_pid(), tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PREPARED); @@ -273,7 +275,7 @@ MPI_Request Request::ibsend(const void *buf, int count, MPI_Datatype datatype, i { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SEND | MPI_REQ_BSEND); if(dst != MPI_PROC_NULL) request->start(); @@ -284,7 +286,7 @@ MPI_Request Request::isend(const void *buf, int count, MPI_Datatype datatype, in { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SEND); if(dst != MPI_PROC_NULL) request->start(); @@ -295,7 +297,7 @@ MPI_Request Request::issend(const void *buf, int count, MPI_Datatype datatype, i { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_ISEND | MPI_REQ_SSEND | MPI_REQ_SEND); if(dst != MPI_PROC_NULL) request->start(); @@ -310,7 +312,7 @@ MPI_Request Request::irecv(void *buf, int count, MPI_Datatype datatype, int src, if (src == MPI_ANY_SOURCE) source = MPI_ANY_SOURCE; else if (src != MPI_PROC_NULL) - source = comm->group()->actor(src)->get_pid(); + source = comm->group()->actor_pid(src); request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, source, simgrid::s4u::this_actor::get_pid(), tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_RECV); @@ -332,8 +334,8 @@ void Request::bsend(const void *buf, int count, MPI_Datatype datatype, int dst, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, - tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_SEND | MPI_REQ_BSEND); + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, + MPI_REQ_NON_PERSISTENT | MPI_REQ_SEND | MPI_REQ_BSEND); if(dst != MPI_PROC_NULL) request->start(); @@ -345,8 +347,8 @@ void Request::send(const void *buf, int count, MPI_Datatype datatype, int dst, i { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, - tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_SEND); + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, + MPI_REQ_NON_PERSISTENT | MPI_REQ_SEND); if(dst != MPI_PROC_NULL) request->start(); wait(&request, MPI_STATUS_IGNORE); @@ -357,7 +359,7 @@ void Request::ssend(const void *buf, int count, MPI_Datatype datatype, int dst, { MPI_Request request = nullptr; /* MC needs the comm to be set to nullptr during the call */ request = new Request(buf == MPI_BOTTOM ? nullptr : buf, count, datatype, simgrid::s4u::this_actor::get_pid(), - dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL, tag, comm, + dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL, tag, comm, MPI_REQ_NON_PERSISTENT | MPI_REQ_SSEND | MPI_REQ_SEND); if(dst != MPI_PROC_NULL) @@ -374,8 +376,8 @@ void Request::sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype if (src == MPI_ANY_SOURCE) source = MPI_ANY_SOURCE; else if (src != MPI_PROC_NULL) - source = comm->group()->actor(src)->get_pid(); - int destination = dst != MPI_PROC_NULL ? comm->group()->actor(dst)->get_pid() : MPI_PROC_NULL; + source = comm->group()->actor_pid(src); + int destination = dst != MPI_PROC_NULL ? comm->group()->actor_pid(dst) : MPI_PROC_NULL; std::array requests; std::array stats; @@ -801,9 +803,9 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* static int nsleeps = 1; double speed = s4u::this_actor::get_host()->get_speed(); double maxrate = smpi_cfg_iprobe_cpu_usage(); - auto request = new Request(nullptr, 0, MPI_CHAR, - source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor(source)->get_pid(), - simgrid::s4u::this_actor::get_pid(), tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PROBE); + auto request = + new Request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE : comm->group()->actor_pid(source), + simgrid::s4u::this_actor::get_pid(), tag, comm, MPI_REQ_PERSISTENT | MPI_REQ_RECV | MPI_REQ_PROBE); if (smpi_iprobe_sleep > 0) { /** Compute the number of flops we will sleep **/ s4u::this_actor::exec_init(/*nsleeps: See comment above */ nsleeps * diff --git a/src/smpi/mpi/smpi_win.cpp b/src/smpi/mpi/smpi_win.cpp index 3210d6d872..52aff5ade2 100644 --- a/src/smpi/mpi/smpi_win.cpp +++ b/src/smpi/mpi/smpi_win.cpp @@ -346,7 +346,8 @@ int Win::accumulate(const void *origin_addr, int origin_count, MPI_Datatype orig // prepare receiver request MPI_Request rreq = Request::rma_recv_init(recv_addr, target_count, target_datatype, recv_win->comm_->rank(), - recv_win->comm_->group()->rank(comm_->group()->actor(target_rank)), SMPI_RMA_TAG - 3 - count_, recv_win->comm_, op); + recv_win->comm_->group()->rank(comm_->group()->actor_pid(target_rank)), + SMPI_RMA_TAG - 3 - count_, recv_win->comm_, op); count_++; @@ -442,7 +443,7 @@ int Win::start(MPI_Group group, int /*assert*/) XBT_DEBUG("Entering MPI_Win_Start"); while (j != size) { - int src = comm_->group()->rank(group->actor(j)); + int src = comm_->group()->rank(group->actor_pid(j)); if (src != rank_ && src != MPI_UNDEFINED) { // TODO cheinrich: The check of MPI_UNDEFINED should be useless here reqs[i] = Request::irecv_init(nullptr, 0, MPI_CHAR, src, SMPI_RMA_TAG + 4, comm_); i++; @@ -472,7 +473,7 @@ int Win::post(MPI_Group group, int /*assert*/) XBT_DEBUG("Entering MPI_Win_Post"); while(j!=size){ - int dst = comm_->group()->rank(group->actor(j)); + int dst = comm_->group()->rank(group->actor_pid(j)); if (dst != rank_ && dst != MPI_UNDEFINED) { reqs[i] = Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG + 4, comm_); i++; @@ -503,7 +504,7 @@ int Win::complete(){ std::vector reqs(size); while(j!=size){ - int dst = comm_->group()->rank(group_->actor(j)); + int dst = comm_->group()->rank(group_->actor_pid(j)); if (dst != rank_ && dst != MPI_UNDEFINED) { reqs[i] = Request::send_init(nullptr, 0, MPI_CHAR, dst, SMPI_RMA_TAG + 5, comm_); i++; @@ -536,7 +537,7 @@ int Win::wait(){ std::vector reqs(size); while(j!=size){ - int src = comm_->group()->rank(group_->actor(j)); + int src = comm_->group()->rank(group_->actor_pid(j)); if (src != rank_ && src != MPI_UNDEFINED) { reqs[i] = Request::irecv_init(nullptr, 0, MPI_CHAR, src, SMPI_RMA_TAG + 5, comm_); i++; @@ -671,7 +672,7 @@ int Win::finish_comms(int rank){ // because we only wait for requests that we are responsible for. // Also use the process id here since the request itself returns from src() // and dst() the process id, NOT the rank (which only exists in the context of a communicator). - int proc_id = comm_->group()->actor(rank)->get_pid(); + int proc_id = comm_->group()->actor_pid(rank); auto it = std::stable_partition(begin(requests_), end(requests_), [proc_id](const MPI_Request& req) { return (req == MPI_REQUEST_NULL || (req->src() != proc_id && req->dst() != proc_id)); }); -- 2.20.1