-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2017. 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 "src/kernel/activity/SynchroComm.hpp"
-#include "src/surf/surf_interface.hpp"
-#include "src/simix/smx_network_private.h"
+#include "src/kernel/activity/CommImpl.hpp"
+
#include "simgrid/modelchecker.h"
#include "src/mc/mc_replay.h"
+#include "src/simix/smx_network_private.h"
+#include "src/surf/surf_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_network);
-simgrid::kernel::activity::Comm::Comm(e_smx_comm_type_t _type) : type(_type)
+simgrid::kernel::activity::CommImpl::CommImpl(e_smx_comm_type_t _type) : type(_type)
{
- state = SIMIX_WAITING;
- src_data=nullptr;
- dst_data=nullptr;
+ state = SIMIX_WAITING;
+ src_data = nullptr;
+ dst_data = nullptr;
intrusive_ptr_add_ref(this);
XBT_DEBUG("Create communicate synchro %p", this);
}
-simgrid::kernel::activity::Comm::~Comm()
+simgrid::kernel::activity::CommImpl::~CommImpl()
{
XBT_DEBUG("Really free communication %p", this);
src_buff = nullptr;
}
- if(mbox)
+ if (mbox)
mbox->remove(this);
}
-void simgrid::kernel::activity::Comm::suspend()
+void simgrid::kernel::activity::CommImpl::suspend()
{
/* FIXME: shall we suspend also the timeout synchro? */
if (surf_comm)
surf_comm->suspend();
/* in the other case, the action will be suspended on creation, in SIMIX_comm_start() */
-
}
-void simgrid::kernel::activity::Comm::resume()
+void simgrid::kernel::activity::CommImpl::resume()
{
/*FIXME: check what happen with the timeouts */
if (surf_comm)
/* in the other case, the synchro were not really suspended yet, see SIMIX_comm_suspend() and SIMIX_comm_start() */
}
-void simgrid::kernel::activity::Comm::cancel()
+void simgrid::kernel::activity::CommImpl::cancel()
{
/* if the synchro is a waiting state means that it is still in a mbox */
/* so remove from it and delete it */
}
/** @brief get the amount remaining from the communication */
-double simgrid::kernel::activity::Comm::remains()
+double simgrid::kernel::activity::CommImpl::remains()
{
if (state == SIMIX_RUNNING)
return surf_comm->getRemains();
}
/** @brief This is part of the cleanup process, probably an internal command */
-void simgrid::kernel::activity::Comm::cleanupSurf()
+void simgrid::kernel::activity::CommImpl::cleanupSurf()
{
- if (surf_comm){
+ if (surf_comm) {
surf_comm->unref();
surf_comm = nullptr;
}
- if (src_timeout){
+ if (src_timeout) {
src_timeout->unref();
src_timeout = nullptr;
}
- if (dst_timeout){
+ if (dst_timeout) {
dst_timeout->unref();
dst_timeout = nullptr;
}
}
-void simgrid::kernel::activity::Comm::post()
+void simgrid::kernel::activity::CommImpl::post()
{
/* Update synchro state */
- if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::done)
+ if (src_timeout && src_timeout->getState() == simgrid::surf::Action::State::done)
state = SIMIX_SRC_TIMEOUT;
else if (dst_timeout && dst_timeout->getState() == simgrid::surf::Action::State::done)
state = SIMIX_DST_TIMEOUT;
} else
state = SIMIX_DONE;
- XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d",
- this, (int)state, src_proc, dst_proc, detached);
+ XBT_DEBUG("SIMIX_post_comm: comm %p, state %d, src_proc %p, dst_proc %p, detached: %d", this, (int)state, src_proc,
+ dst_proc, detached);
/* destroy the surf actions associated with the Simix communication */
cleanupSurf();
-/* Copyright (c) 2007-2016. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2007-2017. 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. */
-#ifndef SRC_KERNEL_ACTIVITY_COMMIMPL_HPP_
-#define SRC_KERNEL_ACTIVITY_COMMIMPL_HPP_
+#ifndef SIMIX_SYNCHRO_COMM_HPP
+#define SIMIX_SYNCHRO_COMM_HPP
-#include "simgrid/forward.h"
+#include "src/kernel/activity/ActivityImpl.hpp"
+#include "surf/surf.h"
-#include <atomic>
-#include <simgrid/simix.hpp>
+typedef enum { SIMIX_COMM_SEND, SIMIX_COMM_RECEIVE, SIMIX_COMM_READY, SIMIX_COMM_DONE } e_smx_comm_type_t;
namespace simgrid {
namespace kernel {
namespace activity {
-XBT_PUBLIC_CLASS CommImpl : ActivityImpl
+XBT_PUBLIC_CLASS CommImpl : public ActivityImpl
{
+ ~CommImpl() override;
+
public:
- CommImpl() : piface_(this){};
- ~CommImpl() = default;
+ explicit CommImpl(e_smx_comm_type_t type);
+ void suspend() override;
+ void resume() override;
+ void post() override;
+ void cancel();
+ double remains();
+ void cleanupSurf(); // FIXME: make me protected
+
+ e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
+ smx_mailbox_t mbox = nullptr; /* Rendez-vous where the comm is queued */
+
+#if SIMGRID_HAVE_MC
+ smx_mailbox_t mbox_cpy = nullptr; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR
+ (comm.mbox set to nullptr when the communication is removed from the mailbox
+ (used as garbage collector)) */
+#endif
+ bool detached = false; /* If detached or not */
+
+ void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
+ int (*match_fun)(void*, void*, smx_activity_t) = nullptr; /* Filter function used by the other side. It is used when
+ looking if a given communication matches my needs. For that, myself must match the
+ expectations of the other side, too. See */
+ void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
- using Ptr = boost::intrusive_ptr<ActivityImpl>;
- simgrid::s4u::Comm piface_; // Our interface
+ /* Surf action data */
+ surf_action_t surf_comm = nullptr; /* The Surf communication action encapsulated */
+ surf_action_t src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
+ surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
+ smx_actor_t src_proc = nullptr;
+ smx_actor_t dst_proc = nullptr;
+ double rate = 0.0;
+ double task_size = 0.0;
+
+ /* Data to be transfered */
+ void* src_buff = nullptr;
+ void* dst_buff = nullptr;
+ size_t src_buff_size = 0;
+ size_t* dst_buff_size = nullptr;
+ bool copied = false; /* whether the data were already copied */
+
+ void* src_data = nullptr; /* User data associated to communication */
+ void* dst_data = nullptr;
};
}
}
-}
+} // namespace simgrid::kernel::activity
-#endif /* SRC_KERNEL_ACTIVITY_COMMIMPL_HPP_ */
+#endif
#include "simgrid/s4u/Host.hpp"
-#include "src/kernel/activity/SynchroExec.hpp"
-#include "src/surf/surf_interface.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
#include "src/simix/smx_host_private.h"
+#include "src/surf/surf_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
-simgrid::kernel::activity::Exec::Exec(const char*name, sg_host_t host) :
- host_(host)
+simgrid::kernel::activity::ExecImpl::ExecImpl(const char* name, sg_host_t host) : host_(host)
{
if (name)
this->name = name;
- this->state = SIMIX_RUNNING;
+ this->state = SIMIX_RUNNING;
}
-simgrid::kernel::activity::Exec::~Exec()
+simgrid::kernel::activity::ExecImpl::~ExecImpl()
{
if (surf_exec)
surf_exec->unref();
if (timeoutDetector)
timeoutDetector->unref();
}
-void simgrid::kernel::activity::Exec::suspend()
+void simgrid::kernel::activity::ExecImpl::suspend()
{
XBT_VERB("This exec is suspended (remain: %f)", surf_exec->getRemains());
if (surf_exec)
surf_exec->suspend();
}
-void simgrid::kernel::activity::Exec::resume()
+void simgrid::kernel::activity::ExecImpl::resume()
{
XBT_VERB("This exec is resumed (remain: %f)", surf_exec->getRemains());
if (surf_exec)
surf_exec->resume();
}
-double simgrid::kernel::activity::Exec::remains()
+double simgrid::kernel::activity::ExecImpl::remains()
{
if (state == SIMIX_RUNNING)
return surf_exec->getRemains();
return 0;
}
-void simgrid::kernel::activity::Exec::post()
+void simgrid::kernel::activity::ExecImpl::post()
{
- if (host_ && host_->isOff()) {/* FIXME: handle resource failure for parallel tasks too */
- /* If the host running the synchro failed, notice it. This way, the asking
- * process can be killed if it runs on that host itself */
+ if (host_ && host_->isOff()) { /* FIXME: handle resource failure for parallel tasks too */
+ /* If the host running the synchro failed, notice it. This way, the asking
+ * process can be killed if it runs on that host itself */
state = SIMIX_FAILED;
} else if (surf_exec->getState() == simgrid::surf::Action::State::failed) {
/* If the host running the synchro didn't fail, then the synchro was canceled */
--- /dev/null
+/* Copyright (c) 2007-2017. 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. */
+
+#ifndef SIMIX_SYNCHRO_EXEC_HPP
+#define SIMIX_SYNCHRO_EXEC_HPP
+
+#include "src/kernel/activity/ActivityImpl.hpp"
+#include "surf/surf.h"
+
+namespace simgrid {
+namespace kernel {
+namespace activity {
+
+XBT_PUBLIC_CLASS ExecImpl : public ActivityImpl
+{
+ ~ExecImpl() override;
+
+public:
+ ExecImpl(const char* name, sg_host_t host);
+ void suspend() override;
+ void resume() override;
+ void post() override;
+ double remains();
+
+ sg_host_t host_ =
+ nullptr; /* The host where the execution takes place. If nullptr, then this is a parallel exec (and only surf
+ knows the hosts) */
+ surf_action_t surf_exec = nullptr; /* The Surf execution action encapsulated */
+ surf::Action* timeoutDetector = nullptr;
+};
+}
+}
+} // namespace simgrid::kernel::activity
+#endif
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "src/kernel/activity/MailboxImpl.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
+
+#include "src/kernel/activity/CommImpl.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_mailbox, simix, "Mailbox implementation");
/** @brief Pushes a communication activity into a mailbox
* @param comm What to add
*/
-void MailboxImpl::push(activity::Comm* comm)
+void MailboxImpl::push(activity::CommImpl* comm)
{
this->comm_queue.push_back(comm);
comm->mbox = this;
*/
void MailboxImpl::remove(smx_activity_t activity)
{
- simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(activity);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(activity);
comm->mbox = nullptr;
for (auto it = this->comm_queue.begin(); it != this->comm_queue.end(); it++)
#include <boost/circular_buffer.hpp>
#include "simgrid/s4u/Mailbox.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
+#include "src/kernel/activity/CommImpl.hpp"
#include "src/simix/ActorImpl.hpp"
#define MAX_MAILBOX_SIZE 10000000
static MailboxImpl* byNameOrNull(const char* name);
static MailboxImpl* byNameOrCreate(const char* name);
void setReceiver(s4u::ActorPtr actor);
- void push(activity::Comm* comm);
+ void push(activity::CommImpl* comm);
void remove(smx_activity_t activity);
simgrid::s4u::Mailbox piface_; // Our interface
char* name_;
#include "simgrid/s4u/Host.hpp"
+#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/context/Context.hpp"
-#include "src/kernel/activity/SynchroSleep.hpp"
-#include "src/surf/surf_interface.hpp"
#include "src/simix/ActorImpl.hpp"
#include "src/simix/popping_private.h"
+#include "src/surf/surf_interface.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_process);
-void simgrid::kernel::activity::Sleep::suspend()
+void simgrid::kernel::activity::SleepImpl::suspend()
{
surf_sleep->suspend();
}
-void simgrid::kernel::activity::Sleep::resume()
+void simgrid::kernel::activity::SleepImpl::resume()
{
surf_sleep->resume();
}
-void simgrid::kernel::activity::Sleep::post()
+void simgrid::kernel::activity::SleepImpl::post()
{
while (not simcalls.empty()) {
smx_simcall_t simcall = simcalls.front();
simcalls.pop_front();
e_smx_state_t state;
- switch (surf_sleep->getState()){
+ switch (surf_sleep->getState()) {
case simgrid::surf::Action::State::failed:
simcall->issuer->context->iwannadie = 1;
- //SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
+ // SMX_EXCEPTION(simcall->issuer, host_error, 0, "Host failed");
state = SIMIX_SRC_HOST_FAILURE;
break;
#ifndef SIMIX_SYNCHRO_SLEEP_HPP
#define SIMIX_SYNCHRO_SLEEP_HPP
-#include "surf/surf.h"
#include "src/kernel/activity/ActivityImpl.hpp"
+#include "surf/surf.h"
namespace simgrid {
namespace kernel {
namespace activity {
- XBT_PUBLIC_CLASS Sleep : public ActivityImpl {
- public:
- void suspend() override;
- void resume() override;
- void post() override;
-
- sg_host_t host = nullptr; /* The host that is sleeping */
- surf_action_t surf_sleep = nullptr; /* The Surf sleeping action encapsulated */
- };
-
-}}} // namespace simgrid::kernel::activity
+XBT_PUBLIC_CLASS SleepImpl : public ActivityImpl
+{
+public:
+ void suspend() override;
+ void resume() override;
+ void post() override;
+
+ sg_host_t host = nullptr; /* The host that is sleeping */
+ surf_action_t surf_sleep = nullptr; /* The Surf sleeping action encapsulated */
+};
+}
+}
+} // namespace simgrid::kernel::activity
#endif
+++ /dev/null
-/* Copyright (c) 2007-2017. 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. */
-
-#ifndef SIMIX_SYNCHRO_COMM_HPP
-#define SIMIX_SYNCHRO_COMM_HPP
-
-#include "surf/surf.h"
-#include "src/kernel/activity/ActivityImpl.hpp"
-
-typedef enum {
- SIMIX_COMM_SEND,
- SIMIX_COMM_RECEIVE,
- SIMIX_COMM_READY,
- SIMIX_COMM_DONE
-} e_smx_comm_type_t;
-
-namespace simgrid {
-namespace kernel {
-namespace activity {
-
- XBT_PUBLIC_CLASS Comm : public ActivityImpl {
- ~Comm() override;
- public:
- explicit Comm(e_smx_comm_type_t type);
- void suspend() override;
- void resume() override;
- void post() override;
- void cancel();
- double remains();
- void cleanupSurf(); // FIXME: make me protected
-
- e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
- smx_mailbox_t mbox = nullptr; /* Rendez-vous where the comm is queued */
-
-#if SIMGRID_HAVE_MC
- smx_mailbox_t mbox_cpy = nullptr; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR
- (comm.mbox set to nullptr when the communication is removed from the mailbox
- (used as garbage collector)) */
-#endif
- bool detached = false; /* If detached or not */
-
- void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
- int (*match_fun)(void*,void*,smx_activity_t) = nullptr; /* Filter function used by the other side. It is used when
- looking if a given communication matches my needs. For that, myself must match the
- expectations of the other side, too. See */
- void (*copy_data_fun) (smx_activity_t, void*, size_t) =nullptr;
-
- /* Surf action data */
- surf_action_t surf_comm = nullptr; /* The Surf communication action encapsulated */
- surf_action_t src_timeout = nullptr; /* Surf's actions to instrument the timeouts */
- surf_action_t dst_timeout = nullptr; /* Surf's actions to instrument the timeouts */
- smx_actor_t src_proc = nullptr;
- smx_actor_t dst_proc = nullptr;
- double rate = 0.0;
- double task_size = 0.0;
-
- /* Data to be transfered */
- void *src_buff = nullptr;
- void *dst_buff = nullptr;
- size_t src_buff_size = 0;
- size_t *dst_buff_size = nullptr;
- bool copied = false; /* whether the data were already copied */
-
- void* src_data = nullptr; /* User data associated to communication */
- void* dst_data = nullptr;
- };
-
-}}} // namespace simgrid::kernel::activity
-
-#endif
+++ /dev/null
-/* Copyright (c) 2007-2017. 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. */
-
-#ifndef SIMIX_SYNCHRO_EXEC_HPP
-#define SIMIX_SYNCHRO_EXEC_HPP
-
-#include "surf/surf.h"
-#include "src/kernel/activity/ActivityImpl.hpp"
-
-namespace simgrid {
-namespace kernel {
-namespace activity {
-
- XBT_PUBLIC_CLASS Exec : public ActivityImpl {
- ~Exec() override;
- public:
- Exec(const char*name, sg_host_t host);
- void suspend() override;
- void resume() override;
- void post() override;
- double remains();
-
- sg_host_t host_ = nullptr; /* The host where the execution takes place. If nullptr, then this is a parallel exec (and only surf knows the hosts) */
- surf_action_t surf_exec = nullptr; /* The Surf execution action encapsulated */
- surf::Action* timeoutDetector = nullptr;
- };
-
-}}} // namespace simgrid::kernel::activity
-#endif
}
static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
- simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> comm_addr)
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr)
{
// HACK, type punning
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->process().read(temp_comm, comm_addr);
- simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
+ simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc));
pattern->type = simgrid::mc::PatternCommunicationType::send;
pattern->comm_addr = simcall_comm_isend__get__result(request);
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_synchro;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
mc_model_checker->process().read(temp_synchro,
- remote(static_cast<simgrid::kernel::activity::Comm*>(pattern->comm_addr)));
- simgrid::kernel::activity::Comm* synchro = static_cast<simgrid::kernel::activity::Comm*>(temp_synchro.getBuffer());
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(pattern->comm_addr)));
+ simgrid::kernel::activity::CommImpl* synchro =
+ static_cast<simgrid::kernel::activity::CommImpl*>(temp_synchro.getBuffer());
char* remote_name = mc_model_checker->process().read<char*>(
(std::uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_));
remote((simgrid::smpi::Request*)simcall_comm_irecv__get__data(request)));
pattern->tag = mpi_request.tag();
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->process().read(temp_comm,
- remote(static_cast<simgrid::kernel::activity::Comm*>(pattern->comm_addr)));
- simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(pattern->comm_addr)));
+ simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
char* remote_name;
mc_model_checker->process().read(&remote_name, remote(comm->mbox ? &comm->mbox->name_ : &comm->mbox_cpy->name_));
}
void CommunicationDeterminismChecker::complete_comm_pattern(
- xbt_dynar_t list, simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> comm_addr, unsigned int issuer,
+ xbt_dynar_t list, simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr, unsigned int issuer,
int backtracking)
{
simgrid::mc::PatternCommunication* current_comm_pattern;
public:
// These are used by functions which should be moved in CommunicationDeterminismChecker:
void get_comm_pattern(xbt_dynar_t list, smx_simcall_t request, e_mc_call_type_t call_type, int backtracking);
- void complete_comm_pattern(
- xbt_dynar_t list, simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> comm_addr,
- unsigned int issuer, int backtracking);
+ void complete_comm_pattern(xbt_dynar_t list, simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr,
+ unsigned int issuer, int backtracking);
+
private:
/** Stack representing the position in the exploration graph */
std::list<std::unique_ptr<simgrid::mc::State>> stack_;
case SIMCALL_COMM_WAIT:
{
/* FIXME: check also that src and dst processes are not suspended */
- simgrid::kernel::activity::Comm *act =
- static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(req));
+ simgrid::kernel::activity::CommImpl* act =
+ static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(req));
#if SIMGRID_HAVE_MC
// Fetch from MCed memory:
// HACK, type puning
if (mc_model_checker != nullptr) {
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
mc_model_checker->process().read(temp_comm, remote(act));
- act = static_cast<simgrid::kernel::activity::Comm*>(temp_comm.getBuffer());
+ act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
}
#endif
case SIMCALL_COMM_WAITANY: {
xbt_dynar_t comms;
- simgrid::kernel::activity::Comm *act =
- static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(req));
+ simgrid::kernel::activity::CommImpl* act =
+ static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(req));
#if SIMGRID_HAVE_MC
s_xbt_dynar_t comms_buffer;
#if SIMGRID_HAVE_MC
// Fetch act from MCed memory:
// HACK, type puning
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
if (mc_model_checker != nullptr) {
memcpy(&act, buffer + comms->elmsize * index, sizeof(act));
mc_model_checker->process().read(temp_comm, remote(act));
- act = static_cast<simgrid::kernel::activity::Comm*>(temp_comm.getBuffer());
+ act = static_cast<simgrid::kernel::activity::CommImpl*>(temp_comm.getBuffer());
}
else
#endif
- act = xbt_dynar_get_as(comms, index, simgrid::kernel::activity::Comm*);
+ act = xbt_dynar_get_as(comms, index, simgrid::kernel::activity::CommImpl*);
if (act->src_proc && act->dst_proc)
return true;
}
case MC_CALL_TYPE_WAIT:
case MC_CALL_TYPE_WAITANY:
{
- simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> comm_addr = nullptr;
- if (call_type == MC_CALL_TYPE_WAIT)
- comm_addr = remote(static_cast<simgrid::kernel::activity::Comm*>(
- simcall_comm_wait__get__comm(req)));
- else {
- simgrid::kernel::activity::Comm* addr;
- // comm_addr = REMOTE(xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_synchro_t)):
- simgrid::mc::read_element(mc_model_checker->process(), &addr,
- remote(simcall_comm_waitany__get__comms(req)), value, sizeof(comm_addr));
- comm_addr = remote(addr);
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr = nullptr;
+ if (call_type == MC_CALL_TYPE_WAIT)
+ comm_addr = remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(req)));
+ else {
+ simgrid::kernel::activity::CommImpl* addr;
+ // comm_addr = REMOTE(xbt_dynar_get_as(simcall_comm_waitany__get__comms(req), value, smx_synchro_t)):
+ simgrid::mc::read_element(mc_model_checker->process(), &addr, remote(simcall_comm_waitany__get__comms(req)),
+ value, sizeof(comm_addr));
+ comm_addr = remote(addr);
}
checker->complete_comm_pattern(pattern, comm_addr,
MC_smx_simcall_get_issuer(req)->pid, backtracking);
static char *pointer_to_string(void *pointer);
static char *buff_size_to_string(size_t size);
-static inline
-simgrid::kernel::activity::Comm* MC_get_comm(smx_simcall_t r)
+static inline simgrid::kernel::activity::CommImpl* MC_get_comm(smx_simcall_t r)
{
switch (r->call ) {
case SIMCALL_COMM_WAIT:
- return static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(r));
+ return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(r));
case SIMCALL_COMM_TEST:
- return static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_test__get__comm(r));
+ return static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__get__comm(r));
default:
return nullptr;
}
// Those are internal requests, we do not need indirection
// because those objects are copies:
- simgrid::kernel::activity::Comm* synchro1 = MC_get_comm(r1);
- simgrid::kernel::activity::Comm* synchro2 = MC_get_comm(r2);
+ simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
+ simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
if ((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV)
&& r2->call == SIMCALL_COMM_WAIT) {
// Those are internal requests, we do not need indirection
// because those objects are copies:
- simgrid::kernel::activity::Comm* synchro1 = MC_get_comm(r1);
- simgrid::kernel::activity::Comm* synchro2 = MC_get_comm(r2);
+ simgrid::kernel::activity::CommImpl* synchro1 = MC_get_comm(r1);
+ simgrid::kernel::activity::CommImpl* synchro2 = MC_get_comm(r2);
switch(r1->call) {
case SIMCALL_COMM_ISEND:
}
case SIMCALL_COMM_WAIT: {
- simgrid::kernel::activity::Comm* remote_act =
- static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(req));
+ simgrid::kernel::activity::CommImpl* remote_act =
+ static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(req));
char* p;
if (value == -1) {
type = "WaitTimeout";
type = "Wait";
p = pointer_to_string(remote_act);
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_synchro;
- simgrid::kernel::activity::Comm* act;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
+ simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->process().read(temp_synchro, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_act)));
+ mc_model_checker->process().read(temp_synchro,
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
act = temp_synchro.getBuffer();
} else
act = remote_act;
}
case SIMCALL_COMM_TEST: {
- simgrid::kernel::activity::Comm* remote_act = static_cast<simgrid::kernel::activity::Comm*>(
- simcall_comm_test__get__comm(req));
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_synchro;
- simgrid::kernel::activity::Comm* act;
+ simgrid::kernel::activity::CommImpl* remote_act =
+ static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_test__get__comm(req));
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_synchro;
+ simgrid::kernel::activity::CommImpl* act;
if (use_remote_comm) {
- mc_model_checker->process().read(temp_synchro, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_act)));
+ mc_model_checker->process().read(temp_synchro,
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
act = temp_synchro.getBuffer();
} else
act = remote_act;
return true;
}
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_act)));
- simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
+ mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
return comm->src_proc && comm->dst_proc;
}
label = simgrid::xbt::string_printf("[(%lu)] WaitTimeout", issuer->pid);
} else {
smx_activity_t remote_act = simcall_comm_wait__get__comm(req);
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_act)));
- simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
+ mc_model_checker->process().read(temp_comm,
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
smx_actor_t src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->src_proc));
smx_actor_t dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc));
case SIMCALL_COMM_TEST: {
smx_activity_t remote_act = simcall_comm_test__get__comm(req);
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_comm;
- mc_model_checker->process().read(temp_comm, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_act)));
- simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_comm;
+ mc_model_checker->process().read(temp_comm, remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_act)));
+ simgrid::kernel::activity::CommImpl* comm = temp_comm.getBuffer();
if (comm->src_proc == nullptr || comm->dst_proc == nullptr) {
if (issuer->host)
label = simgrid::xbt::string_printf("[(%lu)%s] Test FALSE", issuer->pid, MC_smx_actor_get_host_name(issuer));
}
case SIMCALL_COMM_WAIT: {
- simgrid::mc::RemotePtr<simgrid::kernel::activity::Comm> remote_act = remote(
- static_cast<simgrid::kernel::activity::Comm*>(simcall_comm_wait__get__comm(&actor->simcall)));
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> temp_act;
+ simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> remote_act =
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(simcall_comm_wait__get__comm(&actor->simcall)));
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> temp_act;
mc_model_checker->process().read(temp_act, remote_act);
- simgrid::kernel::activity::Comm* act = temp_act.getBuffer();
+ simgrid::kernel::activity::CommImpl* act = temp_act.getBuffer();
if (act->src_proc && act->dst_proc)
state->transition.argument = 0;
else if (act->src_proc == nullptr && act->type == SIMIX_COMM_READY
read_element(mc_model_checker->process(),
&remote_comm, remote(simcall_comm_waitany__get__comms(req)),
state->transition.argument, sizeof(remote_comm));
- mc_model_checker->process().read(state->internal_comm, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_comm)));
+ mc_model_checker->process().read(state->internal_comm,
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_comm)));
simcall_comm_wait__set__comm(&state->internal_req, state->internal_comm.getBuffer());
simcall_comm_wait__set__timeout(&state->internal_req, 0);
break;
if (state->transition.argument > 0) {
smx_activity_t remote_comm = mc_model_checker->process().read(
remote(simcall_comm_testany__get__comms(req) + state->transition.argument));
- mc_model_checker->process().read(state->internal_comm, remote(
- static_cast<simgrid::kernel::activity::Comm*>(remote_comm)));
+ mc_model_checker->process().read(state->internal_comm,
+ remote(static_cast<simgrid::kernel::activity::CommImpl*>(remote_comm)));
}
simcall_comm_test__set__comm(&state->internal_req, state->internal_comm.getBuffer());
s_smx_simcall_t internal_req;
/* Can be used as a copy of the remote synchro object */
- simgrid::mc::Remote<simgrid::kernel::activity::Comm> internal_comm;
+ simgrid::mc::Remote<simgrid::kernel::activity::CommImpl> internal_comm;
/** Snapshot of system state (if needed) */
std::shared_ptr<simgrid::mc::Snapshot> system_state;
simdata->setUsed();
if (simdata->host_nb > 0) {
- simdata->compute = static_cast<simgrid::kernel::activity::Exec*>(simcall_execution_parallel_start(
+ simdata->compute = static_cast<simgrid::kernel::activity::ExecImpl*>(simcall_execution_parallel_start(
task->name, simdata->host_nb, simdata->host_list, simdata->flops_parallel_amount,
simdata->bytes_parallel_amount, 1.0, -1.0, timeout));
XBT_DEBUG("Parallel execution action created: %p", simdata->compute);
} else {
- simdata->compute = static_cast<simgrid::kernel::activity::Exec*>(
+ simdata->compute = static_cast<simgrid::kernel::activity::ExecImpl*>(
simcall_execution_start(task->name, simdata->flops_amount, simdata->priority, simdata->bound));
}
simcall_set_category(simdata->compute, task->category);
/* Send it by calling SIMIX network layer */
smx_activity_t act = simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate,
task, sizeof(void *), match_fun, cleanup, nullptr, match_data,detached);
- t_simdata->comm = static_cast<simgrid::kernel::activity::Comm*>(act);
+ t_simdata->comm = static_cast<simgrid::kernel::activity::CommImpl*>(act);
msg_comm_t comm = nullptr;
if (not detached) {
*/
void MSG_comm_copy_data_from_SIMIX(smx_activity_t synchro, void* buff, size_t buff_size)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
SIMIX_comm_copy_pointer_callback(comm, buff, buff_size);
t_simdata->rate, task, sizeof(void *), nullptr, nullptr, nullptr, task, 0);
if (TRACE_is_enabled())
simcall_set_category(comm, task->category);
- t_simdata->comm = static_cast<simgrid::kernel::activity::Comm*>(comm);
- simcall_comm_wait(comm, timeout);
- SIMIX_comm_unref(comm);
+ t_simdata->comm = static_cast<simgrid::kernel::activity::CommImpl*>(comm);
+ simcall_comm_wait(comm, timeout);
+ SIMIX_comm_unref(comm);
}
catch (xbt_ex& e) {
switch (e.category) {
int MSG_task_listen_from(const char *alias)
{
simgrid::s4u::MailboxPtr mbox = simgrid::s4u::Mailbox::byName(alias);
- simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(mbox->front());
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(mbox->front());
if (not comm)
return -1;
#include "simgrid/msg.h"
-#include "src/kernel/activity/SynchroExec.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
-
-#include <xbt/Extendable.hpp>
+#include "src/kernel/activity/CommImpl.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
+#include "xbt/Extendable.hpp"
/**************** datatypes **********************************/
/**************************** Host Extension *********************************/
this->isused = false;
}
- simgrid::kernel::activity::Exec *compute = nullptr; /* SIMIX modeling of computation */
- simgrid::kernel::activity::Comm *comm = nullptr; /* SIMIX modeling of communication */
+ simgrid::kernel::activity::ExecImpl* compute = nullptr; /* SIMIX modeling of computation */
+ simgrid::kernel::activity::CommImpl* comm = nullptr; /* SIMIX modeling of communication */
double bytes_amount = 0.0; /* Data size */
double flops_amount = 0.0; /* Computation size */
msg_process_t sender = nullptr;
void Comm::cancel()
{
- simgrid::kernel::activity::Comm* commPimpl = static_cast<simgrid::kernel::activity::Comm*>(pimpl_);
+ simgrid::kernel::activity::CommImpl* commPimpl = static_cast<simgrid::kernel::activity::CommImpl*>(pimpl_);
commPimpl->cancel();
}
bool Comm::test() {
#include <boost/range/algorithm.hpp>
-#include <xbt/functional.hpp>
-#include <xbt/ex.hpp>
-#include <xbt/sysdep.h>
-#include <xbt/log.h>
-#include <xbt/dict.h>
+#include "xbt/dict.h"
+#include "xbt/ex.hpp"
+#include "xbt/functional.hpp"
+#include "xbt/log.h"
+#include "xbt/sysdep.h"
#include "simgrid/s4u/Host.hpp"
-#include <mc/mc.h>
+#include "mc/mc.h"
#include "smx_private.h"
+#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/SynchroIo.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
-#include "src/kernel/activity/SynchroSleep.hpp"
#include "src/mc/mc_replay.h"
#include "src/mc/remote/Client.hpp"
#include "src/msg/msg_private.h"
/* cancel non-blocking communications */
smx_activity_t synchro = static_cast<smx_activity_t>(process->comms.front());
while (not process->comms.empty()) {
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
/* make sure no one will finish the comm after this process is destroyed,
* because src_proc or dst_proc would be an invalid pointer */
/* destroy the blocking synchro if any */
if (process->waiting_synchro) {
- simgrid::kernel::activity::Exec *exec = dynamic_cast<simgrid::kernel::activity::Exec*>(process->waiting_synchro);
- simgrid::kernel::activity::Comm *comm = dynamic_cast<simgrid::kernel::activity::Comm*>(process->waiting_synchro);
- simgrid::kernel::activity::Sleep *sleep = dynamic_cast<simgrid::kernel::activity::Sleep*>(process->waiting_synchro);
+ simgrid::kernel::activity::ExecImpl* exec =
+ dynamic_cast<simgrid::kernel::activity::ExecImpl*>(process->waiting_synchro);
+ simgrid::kernel::activity::CommImpl* comm =
+ dynamic_cast<simgrid::kernel::activity::CommImpl*>(process->waiting_synchro);
+ simgrid::kernel::activity::SleepImpl* sleep =
+ dynamic_cast<simgrid::kernel::activity::SleepImpl*>(process->waiting_synchro);
simgrid::kernel::activity::Raw *raw = dynamic_cast<simgrid::kernel::activity::Raw*>(process->waiting_synchro);
simgrid::kernel::activity::Io *io = dynamic_cast<simgrid::kernel::activity::Io*>(process->waiting_synchro);
/* cancel the blocking synchro if any */
if (process->waiting_synchro) {
- simgrid::kernel::activity::Exec *exec = dynamic_cast<simgrid::kernel::activity::Exec*>(process->waiting_synchro);
+ simgrid::kernel::activity::ExecImpl* exec =
+ dynamic_cast<simgrid::kernel::activity::ExecImpl*>(process->waiting_synchro);
if (exec != nullptr) {
SIMIX_execution_cancel(process->waiting_synchro);
}
- simgrid::kernel::activity::Comm *comm = dynamic_cast<simgrid::kernel::activity::Comm*>(process->waiting_synchro);
+ simgrid::kernel::activity::CommImpl* comm =
+ dynamic_cast<simgrid::kernel::activity::CommImpl*>(process->waiting_synchro);
if (comm != nullptr) {
process->comms.remove(comm);
comm->cancel();
}
- simgrid::kernel::activity::Sleep *sleep = dynamic_cast<simgrid::kernel::activity::Sleep*>(process->waiting_synchro);
+ simgrid::kernel::activity::SleepImpl* sleep =
+ dynamic_cast<simgrid::kernel::activity::SleepImpl*>(process->waiting_synchro);
if (sleep != nullptr) {
SIMIX_process_sleep_destroy(process->waiting_synchro);
if (not xbt_dynar_member(simix_global->process_to_run, &(process)) && process != SIMIX_process_self()) {
}
static int SIMIX_process_join_finish(smx_process_exit_status_t status, smx_activity_t synchro){
- simgrid::kernel::activity::Sleep *sleep = static_cast<simgrid::kernel::activity::Sleep*>(synchro);
+ simgrid::kernel::activity::SleepImpl* sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(synchro);
if (sleep->surf_sleep) {
sleep->surf_sleep->cancel();
if (host->isOff())
THROWF(host_error, 0, "Host %s failed, you cannot sleep there.", host->cname());
- simgrid::kernel::activity::Sleep *synchro = new simgrid::kernel::activity::Sleep();
+ simgrid::kernel::activity::SleepImpl* synchro = new simgrid::kernel::activity::SleepImpl();
synchro->host = host;
synchro->surf_sleep = host->pimpl_cpu->sleep(duration);
synchro->surf_sleep->setData(synchro);
void SIMIX_process_sleep_destroy(smx_activity_t synchro)
{
XBT_DEBUG("Destroy synchro %p", synchro);
- simgrid::kernel::activity::Sleep *sleep = static_cast<simgrid::kernel::activity::Sleep*>(synchro);
+ simgrid::kernel::activity::SleepImpl* sleep = static_cast<simgrid::kernel::activity::SleepImpl*>(synchro);
if (sleep->surf_sleep) {
sleep->surf_sleep->unref();
#include <functional>
-#include <xbt/functional.hpp>
-
-#include <simgrid/s4u/VirtualMachine.hpp>
-#include <simgrid/simix/blocking_simcall.hpp>
-
#include "mc/mc.h"
+#include "simgrid/s4u/VirtualMachine.hpp"
+#include "simgrid/simix.hpp"
+#include "simgrid/simix/blocking_simcall.hpp"
#include "smx_private.h"
-#include "src/kernel/activity/SynchroComm.hpp"
+#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_forward.hpp"
#include "src/mc/mc_replay.h"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
#include "src/simix/smx_host_private.h"
#include "xbt/ex.h"
-
-#include <simgrid/simix.hpp>
+#include "xbt/functional.hpp"
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
*/
void simcall_comm_cancel(smx_activity_t synchro)
{
- simgrid::simix::kernelImmediate([synchro]{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::simix::kernelImmediate([synchro] {
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
comm->cancel();
});
}
-/* Copyright (c) 2010-2015. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-2017. 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 "src/mc/mc_private.h"
#endif
-#include "src/kernel/activity/SynchroExec.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
-#include "src/kernel/activity/SynchroSleep.hpp"
-#include "src/kernel/activity/SynchroRaw.hpp"
+#include "src/kernel/activity/CommImpl.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
+#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/SynchroIo.hpp"
+#include "src/kernel/activity/SynchroRaw.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_popping, simix,
"Popping part of SIMIX (transmuting from user request into kernel handlers)");
#include "src/smpi/smpi_process.hpp"
-#include "src/kernel/activity/SynchroExec.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
-#include "src/kernel/activity/SynchroSleep.hpp"
+#include "src/kernel/activity/CommImpl.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
+#include "src/kernel/activity/SleepImpl.hpp"
#include "src/kernel/activity/SynchroIo.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
const char* synchro_description = "unknown";
- if (dynamic_cast<simgrid::kernel::activity::Exec*>(process->waiting_synchro) != nullptr)
+ if (dynamic_cast<simgrid::kernel::activity::ExecImpl*>(process->waiting_synchro) != nullptr)
synchro_description = "execution";
- if (dynamic_cast<simgrid::kernel::activity::Comm*>(process->waiting_synchro) != nullptr)
+ if (dynamic_cast<simgrid::kernel::activity::CommImpl*>(process->waiting_synchro) != nullptr)
synchro_description = "communication";
- if (dynamic_cast<simgrid::kernel::activity::Sleep*>(process->waiting_synchro) != nullptr)
+ if (dynamic_cast<simgrid::kernel::activity::SleepImpl*>(process->waiting_synchro) != nullptr)
synchro_description = "sleeping";
if (dynamic_cast<simgrid::kernel::activity::Raw*>(process->waiting_synchro) != nullptr)
#include "mc/mc.h"
#include "smx_private.h"
+#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_replay.h"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
-#include <xbt/ex.hpp>
-
-#include "src/kernel/activity/SynchroComm.hpp"
+#include "xbt/ex.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_host, simix, "SIMIX hosts");
double bound){
/* alloc structures and initialize */
- simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, issuer->host);
+ simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl(name, issuer->host);
/* set surf's action */
if (not MC_is_active() && not MC_record_replay_is_active()) {
{
/* alloc structures and initialize */
- simgrid::kernel::activity::Exec *exec = new simgrid::kernel::activity::Exec(name, nullptr);
+ simgrid::kernel::activity::ExecImpl* exec = new simgrid::kernel::activity::ExecImpl(name, nullptr);
/* set surf's synchro */
sg_host_t *host_list_cpy = xbt_new0(sg_host_t, host_nb);
void SIMIX_execution_cancel(smx_activity_t synchro)
{
XBT_DEBUG("Cancel synchro %p", synchro);
- simgrid::kernel::activity::Exec *exec = static_cast<simgrid::kernel::activity::Exec *>(synchro);
+ simgrid::kernel::activity::ExecImpl* exec = static_cast<simgrid::kernel::activity::ExecImpl*>(synchro);
if (exec->surf_exec)
exec->surf_exec->cancel();
void SIMIX_execution_set_priority(smx_activity_t synchro, double priority)
{
- simgrid::kernel::activity::Exec *exec = static_cast<simgrid::kernel::activity::Exec *>(synchro);
+ simgrid::kernel::activity::ExecImpl* exec = static_cast<simgrid::kernel::activity::ExecImpl*>(synchro);
if(exec->surf_exec)
exec->surf_exec->setPriority(priority);
}
void SIMIX_execution_set_bound(smx_activity_t synchro, double bound)
{
- simgrid::kernel::activity::Exec *exec = static_cast<simgrid::kernel::activity::Exec *>(synchro);
+ simgrid::kernel::activity::ExecImpl* exec = static_cast<simgrid::kernel::activity::ExecImpl*>(synchro);
if(exec->surf_exec)
static_cast<simgrid::surf::CpuAction*>(exec->surf_exec)->setBound(bound);
}
void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_activity_t synchro)
{
- simgrid::kernel::activity::Exec *exec = static_cast<simgrid::kernel::activity::Exec *>(synchro);
+ simgrid::kernel::activity::ExecImpl* exec = static_cast<simgrid::kernel::activity::ExecImpl*>(synchro);
XBT_DEBUG("Wait for execution of synchro %p, state %d", synchro, (int)synchro->state);
/* Associate this simcall to the synchro */
SIMIX_execution_finish(exec);
}
-void SIMIX_execution_finish(simgrid::kernel::activity::Exec *exec)
+void SIMIX_execution_finish(simgrid::kernel::activity::ExecImpl* exec)
{
for (smx_simcall_t simcall : exec->simcalls) {
switch (exec->state) {
if (synchro->state != SIMIX_RUNNING)
return;
- simgrid::kernel::activity::Exec *exec = dynamic_cast<simgrid::kernel::activity::Exec *>(synchro);
+ simgrid::kernel::activity::ExecImpl* exec = dynamic_cast<simgrid::kernel::activity::ExecImpl*>(synchro);
if (exec != nullptr) {
exec->surf_exec->setCategory(category);
return;
}
- simgrid::kernel::activity::Comm *comm = dynamic_cast<simgrid::kernel::activity::Comm *>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = dynamic_cast<simgrid::kernel::activity::CommImpl*>(synchro);
if (comm != nullptr) {
comm->surf_comm->setCategory(category);
}
#include "simgrid/simix.h"
#include "popping_private.h"
-#include "src/kernel/activity/SynchroExec.hpp"
+#include "src/kernel/activity/ExecImpl.hpp"
/** @brief Host datatype from SIMIX POV */
namespace simgrid {
XBT_PRIVATE void SIMIX_execution_set_priority(smx_activity_t synchro, double priority);
XBT_PRIVATE void SIMIX_execution_set_bound(smx_activity_t synchro, double bound);
-XBT_PRIVATE void SIMIX_execution_finish(simgrid::kernel::activity::Exec *exec);
+XBT_PRIVATE void SIMIX_execution_finish(simgrid::kernel::activity::ExecImpl* exec);
XBT_PRIVATE void SIMIX_set_category(smx_activity_t synchro, const char *category);
#include <boost/range/algorithm.hpp>
+#include "src/kernel/activity/CommImpl.hpp"
#include <xbt/ex.hpp>
#include "simgrid/s4u/Host.hpp"
#include "src/surf/cpu_interface.hpp"
#include "src/surf/surf_interface.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
#include "src/surf/network_interface.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization");
static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
static void SIMIX_comm_copy_data(smx_activity_t comm);
static void SIMIX_comm_start(smx_activity_t synchro);
-static simgrid::kernel::activity::Comm*
+static simgrid::kernel::activity::CommImpl*
_find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
int (*match_fun)(void*, void*, smx_activity_t), void* user_data, smx_activity_t my_synchro,
bool remove_matching);
* \param type The type of communication we are looking for (comm_send, comm_recv)
* \return The communication activity if found, nullptr otherwise
*/
-static simgrid::kernel::activity::Comm*
+static simgrid::kernel::activity::CommImpl*
_find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
int (*match_fun)(void*, void*, smx_activity_t), void* this_user_data, smx_activity_t my_synchro,
bool remove_matching)
for(auto it = deque->begin(); it != deque->end(); it++){
smx_activity_t synchro = *it;
- simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
if (comm->type == SIMIX_COMM_SEND) {
other_user_data = comm->src_data;
XBT_DEBUG("Found a matching communication synchro %p", comm);
if (remove_matching)
deque->erase(it);
- comm = static_cast<simgrid::kernel::activity::Comm*>(SIMIX_comm_ref(comm));
+ comm = static_cast<simgrid::kernel::activity::CommImpl*>(SIMIX_comm_ref(comm));
#if SIMGRID_HAVE_MC
comm->mbox_cpy = comm->mbox;
#endif
XBT_DEBUG("send from %p", mbox);
/* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */
- simgrid::kernel::activity::Comm* this_comm = new simgrid::kernel::activity::Comm(SIMIX_COMM_SEND);
+ simgrid::kernel::activity::CommImpl* this_comm = new simgrid::kernel::activity::CommImpl(SIMIX_COMM_SEND);
/* Look for communication synchro matching our needs. We also provide a description of
* ourself so that the other side also gets a chance of choosing if it wants to match with us.
*
* If it is not found then push our communication into the rendez-vous point */
- simgrid::kernel::activity::Comm* other_comm =
+ simgrid::kernel::activity::CommImpl* other_comm =
_find_matching_comm(&mbox->comm_queue, SIMIX_COMM_RECEIVE, match_fun, data, this_comm, /*remove_matching*/ true);
if (not other_comm) {
//this mailbox is for small messages, which have to be sent right now
other_comm->state = SIMIX_READY;
other_comm->dst_proc=mbox->permanent_receiver.get();
- other_comm = static_cast<simgrid::kernel::activity::Comm*>(SIMIX_comm_ref(other_comm));
+ other_comm = static_cast<simgrid::kernel::activity::CommImpl*>(SIMIX_comm_ref(other_comm));
mbox->done_comm_queue.push_back(other_comm);
XBT_DEBUG("pushing a message into the permanent receive list %p, comm %p", mbox, &(other_comm));
void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
void *data, double rate)
{
- simgrid::kernel::activity::Comm* this_synchro = new simgrid::kernel::activity::Comm(SIMIX_COMM_RECEIVE);
+ simgrid::kernel::activity::CommImpl* this_synchro = new simgrid::kernel::activity::CommImpl(SIMIX_COMM_RECEIVE);
XBT_DEBUG("recv from %p %p. this_synchro=%p", mbox, &mbox->comm_queue, this_synchro);
- simgrid::kernel::activity::Comm* other_comm;
+ simgrid::kernel::activity::CommImpl* other_comm;
//communication already done, get it inside the list of completed comms
if (mbox->permanent_receiver != nullptr && not mbox->done_comm_queue.empty()) {
mbox->push(this_synchro);
} else {
SIMIX_comm_unref(this_synchro);
- other_comm = static_cast<simgrid::kernel::activity::Comm*>(other_comm);
+ other_comm = static_cast<simgrid::kernel::activity::CommImpl*>(other_comm);
other_comm->state = SIMIX_READY;
other_comm->type = SIMIX_COMM_READY;
int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data)
{
XBT_DEBUG("iprobe from %p %p", mbox, &mbox->comm_queue);
- simgrid::kernel::activity::Comm* this_comm;
+ simgrid::kernel::activity::CommImpl* this_comm;
int smx_type;
if(type == 1){
- this_comm = new simgrid::kernel::activity::Comm(SIMIX_COMM_SEND);
+ this_comm = new simgrid::kernel::activity::CommImpl(SIMIX_COMM_SEND);
smx_type = SIMIX_COMM_RECEIVE;
} else{
- this_comm = new simgrid::kernel::activity::Comm(SIMIX_COMM_RECEIVE);
+ this_comm = new simgrid::kernel::activity::CommImpl(SIMIX_COMM_RECEIVE);
smx_type = SIMIX_COMM_SEND;
}
smx_activity_t other_synchro=nullptr;
if (timeout < 0.0)
THROW_IMPOSSIBLE;
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
if (comm->src_proc == simcall->issuer)
comm->state = SIMIX_SRC_TIMEOUT;
else
surf_action_t sleep = simcall->issuer->host->pimpl_cpu->sleep(timeout);
sleep->setData(synchro);
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
if (simcall->issuer == comm->src_proc)
comm->src_timeout = sleep;
else
void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_activity_t synchro)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
if (MC_is_active() || MC_record_replay_is_active()){
simcall_comm_test__set__result(simcall, comm->src_proc && comm->dst_proc);
*/
static inline void SIMIX_comm_start(smx_activity_t synchro)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
/* If both the sender and the receiver are already there, start the communication */
if (synchro->state == SIMIX_READY) {
*/
void SIMIX_comm_finish(smx_activity_t synchro)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
while (not synchro->simcalls.empty()) {
smx_simcall_t simcall = synchro->simcalls.front();
void SIMIX_comm_copy_pointer_callback(smx_activity_t synchro, void* buff, size_t buff_size)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
xbt_assert((buff_size == sizeof(void *)), "Cannot copy %zu bytes: must be sizeof(void*)", buff_size);
*(void **) (comm->dst_buff) = buff;
void SIMIX_comm_copy_buffer_callback(smx_activity_t synchro, void* buff, size_t buff_size)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
XBT_DEBUG("Copy the data over");
memcpy(comm->dst_buff, buff, buff_size);
*/
void SIMIX_comm_copy_data(smx_activity_t synchro)
{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = static_cast<simgrid::kernel::activity::CommImpl*>(synchro);
size_t buff_size = comm->src_buff_size;
/* If there is no data to copy then return */
void smpi_comm_copy_buffer_callback(smx_activity_t synchro, void *buff, size_t buff_size)
{
- simgrid::kernel::activity::Comm *comm = dynamic_cast<simgrid::kernel::activity::Comm*>(synchro);
+ simgrid::kernel::activity::CommImpl* comm = dynamic_cast<simgrid::kernel::activity::CommImpl*>(synchro);
int src_shared = 0;
int dst_shared = 0;
size_t src_offset = 0;
/* 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 "src/smpi/smpi_request.hpp"
+
#include "mc/mc.h"
+#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_replay.h"
#include "src/smpi/SmpiHost.hpp"
-#include "src/kernel/activity/SynchroComm.hpp"
#include "src/smpi/private.h"
#include "src/smpi/smpi_comm.hpp"
#include "src/smpi/smpi_datatype.hpp"
#include "src/smpi/smpi_op.hpp"
#include "src/smpi/smpi_process.hpp"
-#include "src/smpi/smpi_request.hpp"
#include <algorithm>
}
if (request->action_ != nullptr){
- simgrid::kernel::activity::Comm *sync_comm = static_cast<simgrid::kernel::activity::Comm*>(request->action_);
+ simgrid::kernel::activity::CommImpl* sync_comm =
+ static_cast<simgrid::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_ & PREPARED) == 0) {
-/* Copyright (c) 2010, 2013-2017. The SimGrid Team.
- * All rights reserved. */
+/* Copyright (c) 2010-2017. 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. */
#ifndef SMPI_REQUEST_HPP_INCLUDED
#define SMPI_REQUEST_HPP_INCLUDED
+#include "smpi/smpi.h"
#include "src/smpi/smpi_f2c.hpp"
namespace simgrid{
src/simix/smx_network_private.h
src/simix/smx_private.h
src/simix/smx_synchro_private.h
- src/kernel/activity/ActivityImpl.hpp
- src/kernel/activity/CommImpl.hpp
- src/kernel/activity/SynchroComm.hpp
- src/kernel/activity/SynchroExec.hpp
- src/kernel/activity/SynchroIo.hpp
- src/kernel/activity/SynchroSleep.hpp
- src/kernel/activity/SynchroRaw.hpp
src/smpi/colls/coll_tuned_topo.h
src/smpi/colls/colls_private.h
src/smpi/colls/smpi_mvapich2_selector_stampede.h
src/simix/smx_synchro.cpp
src/simix/popping.cpp
src/kernel/activity/ActivityImpl.cpp
+ src/kernel/activity/ActivityImpl.hpp
+ src/kernel/activity/CommImpl.cpp
+ src/kernel/activity/CommImpl.hpp
+ src/kernel/activity/ExecImpl.cpp
+ src/kernel/activity/ExecImpl.hpp
src/kernel/activity/MailboxImpl.cpp
src/kernel/activity/MailboxImpl.hpp
- src/kernel/activity/SynchroComm.cpp
- src/kernel/activity/SynchroExec.cpp
- src/kernel/activity/SynchroSleep.cpp
- src/kernel/activity/SynchroRaw.cpp
+ src/kernel/activity/SleepImpl.cpp
+ src/kernel/activity/SleepImpl.hpp
src/kernel/activity/SynchroIo.cpp
+ src/kernel/activity/SynchroIo.hpp
+ src/kernel/activity/SynchroRaw.cpp
+ src/kernel/activity/SynchroRaw.hpp
${SIMIX_GENERATED_SRC}
)