Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
kill kill simcall
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 Aug 2017 13:26:07 +0000 (15:26 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Fri, 11 Aug 2017 13:26:07 +0000 (15:26 +0200)
include/simgrid/simix.h
src/s4u/s4u_actor.cpp
src/simix/ActorImpl.cpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_global.cpp
src/smpi/bindings/smpi_pmpi.cpp

index 80721f5..de1ac3a 100644 (file)
@@ -199,7 +199,6 @@ XBT_PUBLIC(smx_actor_t)
 simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv,
                        std::map<std::string, std::string>* properties);
 
 simcall_process_create(const char* name, xbt_main_func_t code, void* data, sg_host_t host, int argc, char** argv,
                        std::map<std::string, std::string>* properties);
 
-XBT_PUBLIC(void) simcall_process_kill(smx_actor_t process);
 XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
 XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
 
 XBT_PUBLIC(void) simcall_process_killall(int reset_pid);
 XBT_PUBLIC(void) SIMIX_process_throw(smx_actor_t process, xbt_errcat_t cat, int value, const char *msg);
 
index 7dcef8f..f3f5ab0 100644 (file)
@@ -134,7 +134,7 @@ void Actor::kill(aid_t pid)
 {
   smx_actor_t process = SIMIX_process_from_PID(pid);
   if(process != nullptr) {
 {
   smx_actor_t process = SIMIX_process_from_PID(pid);
   if(process != nullptr) {
-    simcall_process_kill(process);
+    simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
   } else {
     std::ostringstream oss;
     oss << "kill: ("<< pid <<") - No such process" << std::endl;
   } else {
     std::ostringstream oss;
     oss << "kill: ("<< pid <<") - No such process" << std::endl;
@@ -147,7 +147,9 @@ smx_actor_t Actor::getImpl() {
 }
 
 void Actor::kill() {
 }
 
 void Actor::kill() {
-  simcall_process_kill(pimpl_);
+  smx_actor_t process = SIMIX_process_self();
+  simgrid::simix::kernelImmediate(
+      [this, process] { SIMIX_process_kill(pimpl_, (pimpl_ == simix_global->maestro_process) ? pimpl_ : process); });
 }
 
 // ***** Static functions *****
 }
 
 // ***** Static functions *****
@@ -294,7 +296,8 @@ bool isSuspended()
 
 void kill()
 {
 
 void kill()
 {
-  simcall_process_kill(SIMIX_process_self());
+  smx_actor_t process = SIMIX_process_self();
+  simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
 }
 
 void onExit(int_f_pvoid_pvoid_t fun, void* data)
 }
 
 void onExit(int_f_pvoid_pvoid_t fun, void* data)
index 00d518b..610678f 100644 (file)
@@ -457,9 +457,6 @@ void SIMIX_process_runall()
   simix_global->process_to_run.clear();
 }
 
   simix_global->process_to_run.clear();
 }
 
-void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process) {
-  SIMIX_process_kill(process, simcall->issuer);
-}
 /**
  * \brief Internal function to kill a SIMIX process.
  *
 /**
  * \brief Internal function to kill a SIMIX process.
  *
index 16ee544..d8a0a0f 100644 (file)
@@ -154,19 +154,6 @@ e_smx_state_t simcall_execution_wait(smx_activity_t execution)
   return (e_smx_state_t) simcall_BODY_execution_wait(execution);
 }
 
   return (e_smx_state_t) simcall_BODY_execution_wait(execution);
 }
 
-/**
- * \ingroup simix_process_management
- * \brief Kills a SIMIX process.
- *
- * This function simply kills a  process.
- *
- * \param process poor victim
- */
-void simcall_process_kill(smx_actor_t process)
-{
-  simcall_BODY_process_kill(process);
-}
-
 /**
  * \ingroup simix_process_management
  * \brief Kills all SIMIX processes.
 /**
  * \ingroup simix_process_management
  * \brief Kills all SIMIX processes.
index d16dc06..eb130f4 100644 (file)
  */
 
 #include "src/simix/popping_private.h"
  */
 
 #include "src/simix/popping_private.h"
-static inline smx_actor_t simcall_process_kill__get__process(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
-}
-static inline smx_actor_t simcall_process_kill__getraw__process(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<smx_actor_t>(simcall->args[0]);
-}
-static inline void simcall_process_kill__set__process(smx_simcall_t simcall, smx_actor_t arg)
-{
-  simgrid::simix::marshal<smx_actor_t>(simcall->args[0], arg);
-}
-
 static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<int>(simcall->args[0]);
 static inline int simcall_process_killall__get__reset_pid(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<int>(simcall->args[0]);
@@ -1461,7 +1448,6 @@ static inline void simcall_run_blocking__set__code(smx_simcall_t simcall, std::f
 
 /* The prototype of all simcall handlers, automatically generated for you */
 
 
 /* The prototype of all simcall handlers, automatically generated for you */
 
-XBT_PRIVATE void simcall_HANDLER_process_kill(smx_simcall_t simcall, smx_actor_t process);
 XBT_PRIVATE void simcall_HANDLER_process_killall(smx_simcall_t simcall, int reset_pid);
 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_killall(smx_simcall_t simcall, int reset_pid);
 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);
index c2c83cc..3a1bd5e 100644 (file)
@@ -36,12 +36,6 @@ inline static R simcall(e_smx_simcall_t call, T const&... t)
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
 
   return simgrid::simix::unmarshal<R>(self->simcall.result);
 }
 
-inline static void simcall_BODY_process_kill(smx_actor_t process) {
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) simcall_HANDLER_process_kill(&SIMIX_process_self()->simcall, process);
-    return simcall<void, smx_actor_t>(SIMCALL_PROCESS_KILL, process);
-  }
-
 inline static void simcall_BODY_process_killall(int reset_pid) {
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
 inline static void simcall_BODY_process_killall(int reset_pid) {
     /* Go to that function to follow the code flow through the simcall barrier */
     if (0) simcall_HANDLER_process_killall(&SIMIX_process_self()->simcall, reset_pid);
index 8c5c937..a2f3155 100644 (file)
@@ -19,7 +19,6 @@
  */
 typedef enum {
   SIMCALL_NONE,
  */
 typedef enum {
   SIMCALL_NONE,
-  SIMCALL_PROCESS_KILL,
   SIMCALL_PROCESS_KILLALL,
   SIMCALL_PROCESS_CLEANUP,
   SIMCALL_PROCESS_SUSPEND,
   SIMCALL_PROCESS_KILLALL,
   SIMCALL_PROCESS_CLEANUP,
   SIMCALL_PROCESS_SUSPEND,
index d388546..e52c41f 100644 (file)
@@ -25,7 +25,6 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
 const char* simcall_names[] = {
     "SIMCALL_NONE",
 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
 const char* simcall_names[] = {
     "SIMCALL_NONE",
-    "SIMCALL_PROCESS_KILL",
     "SIMCALL_PROCESS_KILLALL",
     "SIMCALL_PROCESS_CLEANUP",
     "SIMCALL_PROCESS_SUSPEND",
     "SIMCALL_PROCESS_KILLALL",
     "SIMCALL_PROCESS_CLEANUP",
     "SIMCALL_PROCESS_SUSPEND",
@@ -76,11 +75,6 @@ void SIMIX_simcall_handle(smx_simcall_t simcall, int value) {
   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
     return;
   switch (simcall->call) {
   if (simcall->issuer->context->iwannadie && simcall->call != SIMCALL_PROCESS_CLEANUP)
     return;
   switch (simcall->call) {
-case SIMCALL_PROCESS_KILL:
-      simcall_HANDLER_process_kill(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]));
-      SIMIX_simcall_answer(simcall);
-      break;
-
 case SIMCALL_PROCESS_KILLALL:
       simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
 case SIMCALL_PROCESS_KILLALL:
       simcall_HANDLER_process_killall(simcall, simgrid::simix::unmarshal<int>(simcall->args[0]));
       SIMIX_simcall_answer(simcall);
index 3a6cc0f..c13413f 100644 (file)
@@ -35,7 +35,6 @@
 # Last but not the least, you should declare the new simix call in
 # ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
 
 # Last but not the least, you should declare the new simix call in
 # ./include/simgrid/simix.h (otherwise you will get a warning at compile time)
 
-void process_kill(smx_actor_t process);
 void process_killall(int reset_pid);
 void process_cleanup(smx_actor_t process) [[nohandler]];
 void process_suspend(smx_actor_t process) [[block]];
 void process_killall(int reset_pid);
 void process_cleanup(smx_actor_t process) [[nohandler]];
 void process_suspend(smx_actor_t process) [[block]];
index 2aa1d17..0e69735 100644 (file)
@@ -425,20 +425,6 @@ void SIMIX_run()
       /* Run all processes that are ready to run, possibly in parallel */
       SIMIX_process_runall();
 
       /* Run all processes that are ready to run, possibly in parallel */
       SIMIX_process_runall();
 
-      /* Move all killer processes to the end of the list, because killing a process that have an ongoing simcall is a bad idea */
-      simgrid::xbt::three_way_partition(begin(simix_global->process_that_ran), end(simix_global->process_that_ran),
-                                        [](smx_actor_t p) {
-                                          switch (p->simcall.call) {
-                                            case SIMCALL_NONE:
-                                            case SIMCALL_PROCESS_KILL:
-                                              return 2;
-                                            // case SIMCALL_PROCESS_RESUME:
-                                            //   return 1;
-                                            default:
-                                              return 0;
-                                          }
-                                        });
-
       /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */
 
       /* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */
       /* answer sequentially and in a fixed arbitrary order all the simcalls that were issued during that sub-round */
 
       /* WARNING, the order *must* be fixed or you'll jeopardize the simulation reproducibility (see RR-7653) */
index ff6a248..59561a4 100644 (file)
@@ -3,13 +3,14 @@
 /* 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. */
 
+#include "private.h"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
 #include "simgrid/s4u/Engine.hpp"
 #include "simgrid/s4u/Host.hpp"
-#include "private.h"
 #include "smpi_comm.hpp"
 #include "smpi_datatype_derived.hpp"
 #include "smpi_process.hpp"
 #include "smpi_status.hpp"
 #include "smpi_comm.hpp"
 #include "smpi_datatype_derived.hpp"
 #include "smpi_process.hpp"
 #include "smpi_status.hpp"
+#include "src/simix/ActorImpl.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_pmpi, smpi, "Logging specific to SMPI (pmpi)");
 
@@ -119,7 +120,8 @@ int PMPI_Abort(MPI_Comm comm, int errorcode)
 {
   smpi_bench_end();
   // FIXME: should kill all processes in comm instead
 {
   smpi_bench_end();
   // FIXME: should kill all processes in comm instead
-  simcall_process_kill(SIMIX_process_self());
+  smx_actor_t process = SIMIX_process_self();
+  simgrid::simix::kernelImmediate([process] { SIMIX_process_kill(process, process); });
   return MPI_SUCCESS;
 }
 
   return MPI_SUCCESS;
 }