Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
allow remote exec: s4u::Exec->setHost()
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Dec 2017 21:32:59 +0000 (22:32 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 9 Dec 2017 21:32:59 +0000 (22:32 +0100)
15 files changed:
include/simgrid/s4u/Exec.hpp
include/simgrid/simix.h
src/msg/msg_gos.cpp
src/s4u/s4u_actor.cpp
src/s4u/s4u_exec.cpp
src/simix/ActorImpl.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_host.cpp
src/simix/smx_host_private.hpp
src/smpi/internals/smpi_bench.cpp
src/smpi/mpi/smpi_request.cpp

index 5db4722..8896f0e 100644 (file)
@@ -31,12 +31,13 @@ public:
   bool test();
 
   ExecPtr setPriority(double priority);
   bool test();
 
   ExecPtr setPriority(double priority);
+  ExecPtr setHost(Host * host);
 
   double getRemains() override;
   double getRemainingRatio();
 
 private:
 
   double getRemains() override;
   double getRemainingRatio();
 
 private:
-  smx_actor_t runner_  = nullptr;
+  Host* host_          = nullptr;
   double flops_amount_ = 0.0;
   double priority_     = 1.0;
 
   double flops_amount_ = 0.0;
   double priority_     = 1.0;
 
index 7d9245d..ba24e68 100644 (file)
@@ -186,9 +186,8 @@ XBT_PUBLIC(void) simcall_call(smx_actor_t process);
 
 /******************************* Host simcalls ********************************/
 XBT_PUBLIC(void) simcall_host_set_data(sg_host_t host, void *data);
 
 /******************************* 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_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);
index 8b72d65..e5dc660 100644 (file)
@@ -74,7 +74,8 @@ msg_error_t MSG_parallel_task_execute_with_timeout(msg_task_t task, double timeo
       XBT_DEBUG("Parallel execution action created: %p", simdata->compute.get());
     } else {
       simdata->compute = boost::static_pointer_cast<simgrid::kernel::activity::ExecImpl>(
       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);
     }
     simcall_set_category(simdata->compute, task->category);
     comp_state = simcall_execution_wait(simdata->compute);
index cfa7de2..a437de0 100644 (file)
@@ -201,7 +201,7 @@ Actor* Actor::restart()
 ExecPtr Actor::exec_init(double flops_amount)
 {
   ExecPtr res        = ExecPtr(new Exec());
 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;
   res->flops_amount_ = flops_amount;
   res->setRemains(flops_amount);
   return res;
@@ -253,13 +253,13 @@ XBT_PUBLIC(void) sleep_until(double timeout)
 
 void execute(double flops)
 {
 
 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)
 {
   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);
 }
 
   simcall_execution_wait(s);
 }
 
index 1fb2e5b..222ca13 100644 (file)
@@ -15,7 +15,7 @@ namespace s4u {
 
 void Exec::start()
 {
 
 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;
 }
 
   state_ = started;
 }
 
@@ -49,6 +49,11 @@ ExecPtr Exec::setPriority(double priority)
   priority_ = priority;
   return this;
 }
   priority_ = priority;
   return this;
 }
+ExecPtr Exec::setHost(Host* host)
+{
+  host_ = host;
+  return this;
+}
 
 double Exec::getRemains()
 {
 
 double Exec::getRemains()
 {
index fdcb034..87965c9 100644 (file)
@@ -221,7 +221,7 @@ smx_activity_t ActorImpl::suspend(ActorImpl* issuer)
 
     return nullptr;
   } else {
 
     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);
   }
 }
 
   }
 }
 
index 9281dca..9662361 100644 (file)
@@ -55,15 +55,14 @@ void simcall_call(smx_actor_t actor)
  * \param bound
  * \return A new SIMIX execution synchronization
  */
  * \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!");
 
 {
   /* 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);
 }
 
 /**
 }
 
 /**
index 020056e..1ec7132 100644 (file)
@@ -164,6 +164,18 @@ static inline void simcall_execution_start__set__bound(smx_simcall_t simcall, do
 {
   simgrid::simix::marshal<double>(simcall->args[3], arg);
 }
 {
   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);
 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);
@@ -1363,7 +1375,9 @@ XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int rese
 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 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);
 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);
index dd9b622..e464ce2 100644 (file)
@@ -71,11 +71,13 @@ inline static int simcall_BODY_process_sleep(double duration)
   return simcall<int, double>(SIMCALL_PROCESS_SLEEP, duration);
 }
 
   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 */
 {
   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)
 }
 
 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)
index 1d6a4a6..21e7222 100644 (file)
@@ -95,7 +95,12 @@ case SIMCALL_PROCESS_SLEEP:
   break;
 
 case SIMCALL_EXECUTION_START:
   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;
 
   SIMIX_simcall_answer(simcall);
   break;
 
index 99e748f..4faaeed 100644 (file)
@@ -1,4 +1,4 @@
-# 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.
 
 # 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.
@@ -41,7 +41,7 @@ void process_suspend(smx_actor_t process) [[block]];
 int  process_join(smx_actor_t process, double timeout) [[block]];
 int  process_sleep(double duration) [[block]];
 
 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]];
 
 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]];
 
index 3808ea6..00b5bb4 100644 (file)
@@ -145,21 +145,21 @@ void SIMIX_host_autorestart(sg_host_t host)
   process_list.clear();
 }
 
   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 =
 {
 
   /* 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()) {
 
   /* set surf's action */
   if (not MC_is_active() && not MC_record_replay_is_active()) {
index 50a6f5f..b90f189 100644 (file)
@@ -55,7 +55,8 @@ XBT_PRIVATE void SIMIX_set_category(smx_activity_t synchro, const char* category
 }
 
 XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ExecImpl>
 }
 
 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);
 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);
index 21fe974..8077214 100644 (file)
@@ -4,12 +4,13 @@
  * under the terms of the license (GNU LGPL) which comes with this package. */
 
 #include "private.hpp"
  * 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/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 "smpi_process.hpp"
 #include "src/internal_config.h"
 #include "src/mc/mc_replay.hpp"
+#include "src/simix/ActorImpl.hpp"
 #include <unordered_map>
 
 #ifndef WIN32
 #include <unordered_map>
 
 #ifndef WIN32
@@ -43,7 +44,7 @@ void smpi_execute_(double *duration)
 
 void smpi_execute_flops(double flops) {
   XBT_DEBUG("Handle real computation time: %f flops", flops);
 
 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());
   simcall_set_category (action, TRACE_internal_smpi_get_category());
   simcall_execution_wait(action);
   smpi_switch_data_segment(smpi_process()->index());
index 64c3574..6219f43 100644 (file)
@@ -14,6 +14,7 @@
 #include "smpi_process.hpp"
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/mc/mc_replay.hpp"
 #include "smpi_process.hpp"
 #include "src/kernel/activity/CommImpl.hpp"
 #include "src/mc/mc_replay.hpp"
+#include "src/simix/ActorImpl.hpp"
 
 #include <algorithm>
 
 
 #include <algorithm>
 
@@ -629,7 +630,9 @@ void Request::iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
   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) {
   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
     simcall_execution_wait(iprobe_sleep);
   }
   // behave like a receive, but don't do it