-/* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "smpi_request.hpp"
-#include "smpi_host.hpp"
#include "mc/mc.h"
#include "private.hpp"
+#include "simgrid/Exception.hpp"
+#include "simgrid/s4u/Exec.hpp"
#include "smpi_comm.hpp"
#include "smpi_datatype.hpp"
+#include "smpi_host.hpp"
#include "smpi_op.hpp"
-#include "smpi_process.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/simix/ActorImpl.hpp"
+#include "src/smpi/include/smpi_actor.hpp"
#include "xbt/config.hpp"
-#include <xbt/ex.hpp>
#include <algorithm>
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_request, smpi, "Logging specific to SMPI (reques)");
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_request, smpi, "Logging specific to SMPI (request)");
static simgrid::config::Flag<double> smpi_iprobe_sleep(
"smpi/iprobe", "Minimum time to inject inside a call to MPI_Iprobe", 1e-4);
}
}
-int Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+int Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl*)
{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
}else return 0;
}
-int Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+int Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl*)
{
MPI_Request ref = static_cast<MPI_Request>(a);
MPI_Request req = static_cast<MPI_Request>(b);
if ((flags_ & MPI_REQ_RECV) != 0) {
this->print_request("New recv");
- simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_));
+ simgrid::smpi::ActorExt* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_));
int async_small_thresh = simgrid::config::get_value<int>("smpi/async-small-thresh");
if (async_small_thresh != 0 || (flags_ & MPI_REQ_RMA) != 0)
xbt_mutex_release(mut);
} else { /* the RECV flag was not set, so this is a send */
- simgrid::smpi::Process* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_));
+ simgrid::smpi::ActorExt* process = smpi_process_remote(simgrid::s4u::Actor::by_pid(dst_));
int rank = src_;
if (TRACE_smpi_view_internals()) {
TRACE_smpi_send(rank, rank, dst_, tag_, size_);
// nsleeps is a multiplier to the sleeptime, to increase speed of execution, each failed iprobe will increase it
// This can speed up the execution of certain applications by an order of magnitude, such as HPL
static int nsleeps = 1;
- double speed = simgrid::s4u::Actor::self()->get_host()->getSpeed();
+ double speed = s4u::this_actor::get_host()->get_speed();
double maxrate = simgrid::config::get_value<double>("smpi/iprobe-cpu-usage");
MPI_Request 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);
if (smpi_iprobe_sleep > 0) {
- smx_activity_t iprobe_sleep = simcall_execution_start(
- "iprobe", /* flops to executek*/ nsleeps * smpi_iprobe_sleep * speed * maxrate, /* priority */ 1.0,
- /* performance bound */ maxrate * speed, smpi_process()->get_actor()->get_host());
- simcall_execution_wait(iprobe_sleep);
+ /** Compute the number of flops we will sleep **/
+ s4u::this_actor::exec_init(/*nsleeps: See comment above */ nsleeps *
+ /*(in seconds)*/ smpi_iprobe_sleep * speed * maxrate)
+ ->set_name("iprobe")
+ ->start()
+ ->wait();
}
// behave like a receive, but don't do it
smx_mailbox_t mailbox;
}
if (request->action_ != nullptr){
- simgrid::kernel::activity::CommImplPtr sync_comm =
- boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(request->action_);
- MPI_Request req = static_cast<MPI_Request>(sync_comm->src_data);
+ kernel::activity::CommImplPtr sync_comm = boost::static_pointer_cast<kernel::activity::CommImpl>(request->action_);
+ MPI_Request req = static_cast<MPI_Request>(sync_comm->src_data_);
*flag = 1;
if (status != MPI_STATUS_IGNORE && (req->flags_ & MPI_REQ_PREPARED) == 0) {
status->MPI_SOURCE = comm->group()->rank(req->src_);
if (req->cancelled_==1){
if (status!=MPI_STATUS_IGNORE)
status->cancelled=1;
+ if(req->detached_sender_ != nullptr)
+ unref(&(req->detached_sender_));
+ unref(request);
return;
}
if ((requests[index] == MPI_REQUEST_NULL) ||
(not((requests[index]->flags_ & MPI_REQ_ACCUMULATE) && (requests[index]->flags_ & MPI_REQ_RECV)))) {
finish_wait(&requests[index],status);
- if (requests[i] != MPI_REQUEST_NULL && (requests[i]->flags_ & MPI_REQ_NON_PERSISTENT))
+ if (requests[index] != MPI_REQUEST_NULL && (requests[index]->flags_ & MPI_REQ_NON_PERSISTENT))
requests[index] = MPI_REQUEST_NULL;
}
}