bool test();
ExecPtr setPriority(double priority);
+ ExecPtr setHost(Host * host);
double getRemains() override;
double getRemainingRatio();
private:
- smx_actor_t runner_ = nullptr;
+ Host* host_ = nullptr;
double flops_amount_ = 0.0;
double priority_ = 1.0;
/******************************* Host simcalls ********************************/
XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
-XBT_PUBLIC(smx_activity_t) simcall_execution_start(const char *name,
- double flops_amount,
- double priority, double bound);
+XBT_PUBLIC(smx_activity_t)
+simcall_execution_start(const char* name, double flops_amount, double priority, double bound, sg_host_t host);
XBT_PUBLIC(smx_activity_t)
simcall_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
double* bytes_amount, double rate, double timeout);
XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get());
} else {
simdata->compute = boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(
- simcall_execution_start(task->name, simdata->flops_amount, simdata->priority, simdata->bound));
+ simcall_execution_start(task->name, simdata->flops_amount, simdata->priority, simdata->bound,
+ MSG_process_get_host(MSG_process_self())));
}
simcall_set_category(simdata->compute, task->category);
comp_state = simcall_execution_wait(simdata->compute);
ExecPtr Actor::exec_init(double flops_amount)
{
ExecPtr res = ExecPtr(new Exec());
- res->runner_ = SIMIX_process_self();
+ res->host_ = this->getHost();
res->flops_amount_ = flops_amount;
res->setRemains(flops_amount);
return res;
void execute(double flops)
{
- smx_activity_t s = simcall_execution_start(nullptr,flops,1.0/*priority*/,0./*bound*/);
+ smx_activity_t s = simcall_execution_start(nullptr, flops, 1.0 /*priority*/, 0. /*bound*/, getHost());
simcall_execution_wait(s);
}
void execute(double flops, double priority)
{
- smx_activity_t s = simcall_execution_start(nullptr,flops,1 / priority/*priority*/,0./*bound*/);
+ smx_activity_t s = simcall_execution_start(nullptr, flops, 1 / priority /*priority*/, 0. /*bound*/, getHost());
simcall_execution_wait(s);
}
void Exec::start()
{
- pimpl_ = simcall_execution_start(nullptr, flops_amount_, 1 / priority_, 0.);
+ pimpl_ = simcall_execution_start(nullptr, flops_amount_, 1 / priority_, 0., host_);
state_ = started;
}
priority_ = priority;
return this;
}
+ExecPtr Exec::setHost(Host* host)
+{
+ host_ = host;
+ return this;
+}
double Exec::getRemains()
{
return nullptr;
} else {
- return SIMIX_execution_start(this, "suspend", 0.0, 1.0, 0.0);
+ return SIMIX_execution_start(this, "suspend", 0.0, 1.0, 0.0, this->host);
}
}
* \param bound
* \return A new SIMIX execution synchronization
*/
-smx_activity_t simcall_execution_start(const char *name,
- double flops_amount,
- double priority, double bound)
+smx_activity_t simcall_execution_start(const char* name, double flops_amount, double priority, double bound,
+ simgrid::s4u::Host* host)
{
/* checking for infinite values */
xbt_assert(std::isfinite(flops_amount), "flops_amount is not finite!");
xbt_assert(std::isfinite(priority), "priority is not finite!");
- return simcall_BODY_execution_start(name, flops_amount, priority, bound);
+ return simcall_BODY_execution_start(name, flops_amount, priority, bound, host);
}
/**
{
simgrid::simix::marshal<double>(simcall->args[3], arg);
}
+static inline sg_host_t simcall_execution_start__get__host(smx_simcall_t simcall)
+{
+ return simgrid::simix::unmarshal<sg_host_t>(simcall->args[4]);
+}
+static inline sg_host_t simcall_execution_start__getraw__host(smx_simcall_t simcall)
+{
+ return simgrid::simix::unmarshal_raw<sg_host_t>(simcall->args[4]);
+}
+static inline void simcall_execution_start__set__host(smx_simcall_t simcall, sg_host_t arg)
+{
+ simgrid::simix::marshal<sg_host_t>(simcall->args[4], arg);
+}
static inline boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> simcall_execution_start__get__result(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(simcall->result);
XBT_PRIVATE void simcall_HANDLER_process_suspend(smx_simcall_t simcall, smx_actor_t process);
XBT_PRIVATE void simcall_HANDLER_process_join(smx_simcall_t simcall, smx_actor_t process, double timeout);
XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double duration);
-XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount, double priority, double bound);
+XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
+simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount, double priority,
+ double bound, sg_host_t host);
XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data);
XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff, size_t src_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout);
return simcall<int, double>(SIMCALL_PROCESS_SLEEP, duration);
}
-inline static boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> simcall_BODY_execution_start(const char* name, double flops_amount, double priority, double bound)
+inline static boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
+simcall_BODY_execution_start(const char* name, double flops_amount, double priority, double bound, sg_host_t host)
{
if (0) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_execution_start(&SIMIX_process_self()->simcall, name, flops_amount, priority, bound);
- return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>, const char*, double, double, double>(SIMCALL_EXECUTION_START, name, flops_amount, priority, bound);
+ simcall_HANDLER_execution_start(&SIMIX_process_self()->simcall, name, flops_amount, priority, bound, host);
+ return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>, const char*, double, double, double,
+ sg_host_t>(SIMCALL_EXECUTION_START, name, flops_amount, priority, bound, host);
}
inline static boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> simcall_BODY_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double rate, double timeout)
break;
case SIMCALL_EXECUTION_START:
- simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(simcall->result, simcall_HANDLER_execution_start(simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]), simgrid::simix::unmarshal<double>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3])));
+ simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>>(
+ simcall->result,
+ simcall_HANDLER_execution_start(
+ simcall, simgrid::simix::unmarshal<const char*>(simcall->args[0]),
+ simgrid::simix::unmarshal<double>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]),
+ simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<sg_host_t>(simcall->args[4])));
SIMIX_simcall_answer(simcall);
break;
-# Copyright (c) 2014-2016. The SimGrid Team. All rights reserved.
+# Copyright (c) 2014-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.
int process_join(smx_actor_t process, double timeout) [[block]];
int process_sleep(double duration) [[block]];
-boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_start(const char* name, double flops_amount, double priority, double bound);
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_start(const char* name, double flops_amount, double priority, double bound, sg_host_t host);
boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount, double* bytes_amount, double rate, double timeout) [[nohandler]];
int execution_wait(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[block]];
process_list.clear();
}
-boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> simcall_HANDLER_execution_start(smx_simcall_t simcall,
- const char* name,
- double flops_amount,
- double priority, double bound)
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
+simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount, double priority,
+ double bound, sg_host_t host)
{
- return SIMIX_execution_start(simcall->issuer, name,flops_amount,priority,bound);
+ return SIMIX_execution_start(simcall->issuer, name, flops_amount, priority, bound, host);
}
-boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
-SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound)
+boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl> SIMIX_execution_start(smx_actor_t issuer, const char* name,
+ double flops_amount, double priority,
+ double bound, sg_host_t host)
{
/* alloc structures and initialize */
simgrid::kernel::activity::ExecImplPtr exec =
- simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl(name, issuer->host));
+ simgrid::kernel::activity::ExecImplPtr(new simgrid::kernel::activity::ExecImpl(name, host));
/* set surf's action */
if (not MC_is_active() && not MC_record_replay_is_active()) {
}
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
-SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound);
+SIMIX_execution_start(smx_actor_t issuer, const char* name, double flops_amount, double priority, double bound,
+ sg_host_t host);
XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
SIMIX_execution_parallel_start(const char* name, int host_nb, sg_host_t* host_list, double* flops_amount,
double* bytes_amount, double rate, double timeout);
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "private.hpp"
+#include "simgrid/host.h"
#include "simgrid/modelchecker.h"
#include "smpi_comm.hpp"
-#include "simgrid/host.h"
#include "smpi_process.hpp"
#include "src/internal_config.h"
#include "src/mc/mc_replay.hpp"
+#include "src/simix/ActorImpl.hpp"
#include <unordered_map>
#ifndef WIN32
void smpi_execute_flops(double flops) {
XBT_DEBUG("Handle real computation time: %f flops", flops);
- smx_activity_t action = simcall_execution_start("computation", flops, 1, 0);
+ smx_activity_t action = simcall_execution_start("computation", flops, 1, 0, smpi_process()->process()->host);
simcall_set_category (action, TRACE_internal_smpi_get_category());
simcall_execution_wait(action);
smpi_switch_data_segment(smpi_process()->index());
#include "smpi_process.hpp"
#include "src/kernel/activity/CommImpl.hpp"
#include "src/mc/mc_replay.hpp"
+#include "src/simix/ActorImpl.hpp"
#include <algorithm>
MPI_Request request = new Request(nullptr, 0, MPI_CHAR, source == MPI_ANY_SOURCE ? MPI_ANY_SOURCE :
comm->group()->index(source), comm->rank(), tag, comm, PERSISTENT | 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);
+ 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()->process()->host);
simcall_execution_wait(iprobe_sleep);
}
// behave like a receive, but don't do it