X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/91fe7904c884b2d0f5e7408d6e9d1d99886bd365..cf6a1cc5a48717bed67bcb9e32b77e51ea9f53c7:/src/smpi/mpi/smpi_request.cpp diff --git a/src/smpi/mpi/smpi_request.cpp b/src/smpi/mpi/smpi_request.cpp index 0b5dde53b8..e52317b4c3 100644 --- a/src/smpi/mpi/smpi_request.cpp +++ b/src/smpi/mpi/smpi_request.cpp @@ -61,8 +61,7 @@ Request::Request(const void* buf, int count, MPI_Datatype datatype, aid_t src, a detached_sender_ = nullptr; real_src_ = 0; // get src_host if it's available (src is valid) - auto src_process = simgrid::s4u::Actor::by_pid(src); - if (src_process) + if (auto src_process = simgrid::s4u::Actor::by_pid(src)) src_host_ = src_process->get_host(); truncated_ = false; unmatched_types_ = false; @@ -425,8 +424,7 @@ void Request::sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype std::array requests; std::array stats; - aid_t myid = simgrid::s4u::this_actor::get_pid(); - if ((destination == myid) && (source == myid)) { + if (aid_t myid = simgrid::s4u::this_actor::get_pid(); (destination == myid) && (source == myid)) { Datatype::copy(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype); if (status != MPI_STATUS_IGNORE) { status->MPI_SOURCE = source; @@ -593,8 +591,7 @@ void Request::start() mailbox = process->mailbox(); XBT_DEBUG("Is there a corresponding recv already posted in the large mailbox %s?", mailbox->get_cname()); - simgrid::kernel::activity::ActivityImplPtr action = mailbox->iprobe(1, &match_send, static_cast(this)); - if (action == nullptr) { + if (not mailbox->iprobe(1, &match_send, static_cast(this))) { if ((flags_ & MPI_REQ_SSEND) == 0) { mailbox = process->mailbox_small(); XBT_DEBUG("No, nothing in the large mailbox, message is to be sent on the small one %s", @@ -603,8 +600,7 @@ void Request::start() mailbox = process->mailbox_small(); XBT_DEBUG("SSEND : Is there a corresponding recv already posted in the small mailbox %s?", mailbox->get_cname()); - action = mailbox->iprobe(1, &match_send, static_cast(this)); - if (action == nullptr) { + if (not mailbox->iprobe(1, &match_send, static_cast(this))) { XBT_DEBUG("No, we are first, send to large mailbox"); mailbox = process->mailbox(); } @@ -730,8 +726,7 @@ int Request::testsome(int incount, MPI_Request requests[], int *count, int *indi *count = 0; for (int i = 0; i < incount; i++) { if (requests[i] != MPI_REQUEST_NULL && not (requests[i]->flags_ & MPI_REQ_FINISHED)) { - int ret = test(&requests[i], pstat, &flag); - if(ret!=MPI_SUCCESS) + if (test(&requests[i], pstat, &flag) != MPI_SUCCESS) error = 1; if(flag) { indices[*count] = i; @@ -1030,9 +1025,9 @@ void Request::finish_wait(MPI_Request* request, MPI_Status * status) if(req->detached_sender_ != nullptr){ //integrate pseudo-timing for buffering of small messages, do not bother to execute the simcall if 0 simgrid::s4u::Host* dst_host = simgrid::s4u::Actor::by_pid(req->dst_)->get_host(); - double sleeptime = simgrid::s4u::Actor::self()->get_host()->extension()->orecv( - req->real_size(), req->src_host_, dst_host); - if (sleeptime > 0.0) { + if (double sleeptime = simgrid::s4u::Actor::self()->get_host()->extension()->orecv( + req->real_size(), req->src_host_, dst_host); + sleeptime > 0.0) { simgrid::s4u::this_actor::sleep_for(sleeptime); XBT_DEBUG("receiving size of %zu : sleep %f ", req->real_size_, sleeptime); } @@ -1093,9 +1088,8 @@ int Request::wait(MPI_Request * request, MPI_Status * status) // this is not a detached send kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self(); kernel::actor::ActivityWaitSimcall observer{issuer, (*request)->action_.get(), -1}; - kernel::actor::simcall_blocking( - [&observer] { observer.get_activity()->wait_for(observer.get_issuer(), observer.get_timeout()); }, - &observer); + kernel::actor::simcall_blocking([issuer, &observer] { observer.get_activity()->wait_for(issuer, -1); }, + &observer); } catch (const CancelException&) { XBT_VERB("Request cancelled"); }