Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
modernize a non-blocking simcall
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 13 Feb 2019 14:50:35 +0000 (15:50 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Wed, 13 Feb 2019 14:50:35 +0000 (15:50 +0100)
src/simix/libsmx.cpp
src/simix/popping_accessors.hpp
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_network.cpp
src/simix/smx_network_private.hpp

index 127668d..87f6b58 100644 (file)
@@ -21,6 +21,7 @@
 #include "src/plugins/vm/VirtualMachineImpl.hpp"
 #include "src/simix/smx_host_private.hpp"
 #include "src/simix/smx_io_private.hpp"
+#include "src/simix/smx_network_private.hpp"
 
 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix);
 
@@ -205,7 +206,8 @@ smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type,
 {
   xbt_assert(mbox, "No rendez-vous point defined for iprobe");
 
-  return simcall_BODY_comm_iprobe(mbox, type, match_fun, data);
+  return simgrid::simix::simcall(
+      [mbox, type, match_fun, data] { return SIMIX_comm_iprobe(mbox, type, match_fun, data); });
 }
 
 /**
index 6ab80f9..22e6200 100644 (file)
@@ -143,67 +143,6 @@ static inline void simcall_execution_test__set__result(smx_simcall_t simcall, in
   simgrid::simix::marshal<int>(simcall->result, result);
 }
 
-static inline smx_mailbox_t simcall_comm_iprobe__get__mbox(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]);
-}
-static inline smx_mailbox_t simcall_comm_iprobe__getraw__mbox(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<smx_mailbox_t>(simcall->args[0]);
-}
-static inline void simcall_comm_iprobe__set__mbox(smx_simcall_t simcall, smx_mailbox_t arg)
-{
-  simgrid::simix::marshal<smx_mailbox_t>(simcall->args[0], arg);
-}
-static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<int>(simcall->args[1]);
-}
-static inline int simcall_comm_iprobe__getraw__type(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<int>(simcall->args[1]);
-}
-static inline void simcall_comm_iprobe__set__type(smx_simcall_t simcall, int arg)
-{
-  simgrid::simix::marshal<int>(simcall->args[1], arg);
-}
-static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[2]);
-}
-static inline simix_match_func_t simcall_comm_iprobe__getraw__match_fun(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<simix_match_func_t>(simcall->args[2]);
-}
-static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, simix_match_func_t arg)
-{
-  simgrid::simix::marshal<simix_match_func_t>(simcall->args[2], arg);
-}
-static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<void*>(simcall->args[3]);
-}
-static inline void* simcall_comm_iprobe__getraw__data(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<void*>(simcall->args[3]);
-}
-static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg)
-{
-  simgrid::simix::marshal<void*>(simcall->args[3], arg);
-}
-static inline boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_comm_iprobe__get__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result);
-}
-static inline simgrid::kernel::activity::ActivityImpl* simcall_comm_iprobe__getraw__result(smx_simcall_t simcall)
-{
-  return simgrid::simix::unmarshal_raw<simgrid::kernel::activity::ActivityImpl*>(simcall->result);
-}
-static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> result)
-{
-  simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result, result);
-}
-
 static inline smx_actor_t simcall_comm_send__get__sender(smx_simcall_t simcall)
 {
   return simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]);
@@ -1086,7 +1025,6 @@ XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, boost::in
 XBT_PRIVATE void
 simcall_HANDLER_execution_test(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 boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_isend(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_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached);
 XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate);
index 0343cbf..ede5a41 100644 (file)
@@ -72,13 +72,6 @@ inline static int simcall_BODY_execution_test(boost::intrusive_ptr<simgrid::kern
   return simcall<int, boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(SIMCALL_EXECUTION_TEST, execution);
 }
 
-inline static boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_BODY_comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data)
-{
-  if (0) /* Go to that function to follow the code flow through the simcall barrier */
-    simcall_HANDLER_comm_iprobe(&SIMIX_process_self()->simcall, mbox, type, match_fun, data);
-  return simcall<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>, smx_mailbox_t, int, simix_match_func_t, void*>(SIMCALL_COMM_IPROBE, mbox, type, match_fun, data);
-}
-
 inline static void simcall_BODY_comm_send(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)
 {
   if (0) /* Go to that function to follow the code flow through the simcall barrier */
index 6f9457f..692b303 100644 (file)
@@ -24,7 +24,6 @@ typedef enum {
   SIMCALL_PROCESS_SLEEP,
   SIMCALL_EXECUTION_WAIT,
   SIMCALL_EXECUTION_TEST,
-  SIMCALL_COMM_IPROBE,
   SIMCALL_COMM_SEND,
   SIMCALL_COMM_ISEND,
   SIMCALL_COMM_RECV,
index ee85306..28af3fd 100644 (file)
@@ -27,13 +27,31 @@ XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simix_popping);
 
 /** @brief Simcalls' names (generated from src/simix/simcalls.in) */
 const char* simcall_names[] = {
-    "SIMCALL_NONE",           "SIMCALL_PROCESS_SUSPEND",     "SIMCALL_PROCESS_JOIN", "SIMCALL_PROCESS_SLEEP",
-    "SIMCALL_EXECUTION_WAIT", "SIMCALL_EXECUTION_TEST",      "SIMCALL_COMM_IPROBE",  "SIMCALL_COMM_SEND",
-    "SIMCALL_COMM_ISEND",     "SIMCALL_COMM_RECV",           "SIMCALL_COMM_IRECV",   "SIMCALL_COMM_WAITANY",
-    "SIMCALL_COMM_WAIT",      "SIMCALL_COMM_TEST",           "SIMCALL_COMM_TESTANY", "SIMCALL_MUTEX_LOCK",
-    "SIMCALL_MUTEX_TRYLOCK",  "SIMCALL_MUTEX_UNLOCK",        "SIMCALL_COND_WAIT",    "SIMCALL_COND_WAIT_TIMEOUT",
-    "SIMCALL_SEM_ACQUIRE",    "SIMCALL_SEM_ACQUIRE_TIMEOUT", "SIMCALL_IO_WAIT",      "SIMCALL_MC_RANDOM",
-    "SIMCALL_RUN_KERNEL",     "SIMCALL_RUN_BLOCKING",
+    "SIMCALL_NONE",
+    "SIMCALL_PROCESS_SUSPEND",
+    "SIMCALL_PROCESS_JOIN",
+    "SIMCALL_PROCESS_SLEEP",
+    "SIMCALL_EXECUTION_WAIT",
+    "SIMCALL_EXECUTION_TEST",
+    "SIMCALL_COMM_SEND",
+    "SIMCALL_COMM_ISEND",
+    "SIMCALL_COMM_RECV",
+    "SIMCALL_COMM_IRECV",
+    "SIMCALL_COMM_WAITANY",
+    "SIMCALL_COMM_WAIT",
+    "SIMCALL_COMM_TEST",
+    "SIMCALL_COMM_TESTANY",
+    "SIMCALL_MUTEX_LOCK",
+    "SIMCALL_MUTEX_TRYLOCK",
+    "SIMCALL_MUTEX_UNLOCK",
+    "SIMCALL_COND_WAIT",
+    "SIMCALL_COND_WAIT_TIMEOUT",
+    "SIMCALL_SEM_ACQUIRE",
+    "SIMCALL_SEM_ACQUIRE_TIMEOUT",
+    "SIMCALL_IO_WAIT",
+    "SIMCALL_MC_RANDOM",
+    "SIMCALL_RUN_KERNEL",
+    "SIMCALL_RUN_BLOCKING",
 };
 
 /** @private
@@ -69,11 +87,6 @@ case SIMCALL_EXECUTION_TEST:
       simgrid::simix::unmarshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->args[0]));
   break;
 
-case SIMCALL_COMM_IPROBE:
-  simgrid::simix::marshal<boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl>>(simcall->result, simcall_HANDLER_comm_iprobe(simcall, simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[0]), simgrid::simix::unmarshal<int>(simcall->args[1]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[2]), simgrid::simix::unmarshal<void*>(simcall->args[3])));
-  SIMIX_simcall_answer(simcall);
-  break;
-
 case SIMCALL_COMM_SEND:
   simcall_HANDLER_comm_send(simcall, simgrid::simix::unmarshal<smx_actor_t>(simcall->args[0]), simgrid::simix::unmarshal<smx_mailbox_t>(simcall->args[1]), simgrid::simix::unmarshal<double>(simcall->args[2]), simgrid::simix::unmarshal<double>(simcall->args[3]), simgrid::simix::unmarshal<void*>(simcall->args[4]), simgrid::simix::unmarshal<size_t>(simcall->args[5]), simgrid::simix::unmarshal<simix_match_func_t>(simcall->args[6]), simgrid::simix::unmarshal<simix_copy_data_func_t>(simcall->args[7]), simgrid::simix::unmarshal<void*>(simcall->args[8]), simgrid::simix::unmarshal<double>(simcall->args[9]));
   break;
index 03881a4..2e882f4 100644 (file)
@@ -42,7 +42,6 @@ int  process_sleep(double duration) [[block]];
 int           execution_wait(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[block]];
 int           execution_test(boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> execution) [[block]];
 
-boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data);
 void           comm_send(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) [[block]];
 boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_isend(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_clean_func_t clean_fun, simix_copy_data_func_t copy_data_fun, void* data, int detached);
 void           comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) [[block]];
index 9bf9864..73500a9 100644 (file)
@@ -243,14 +243,7 @@ SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_
   return other_comm;
 }
 
-smx_activity_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type,
-                                           simix_match_func_t match_fun, void* data)
-{
-  return SIMIX_comm_iprobe(simcall->issuer, mbox, type, match_fun, data);
-}
-
-smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, simix_match_func_t match_fun,
-                                 void* data)
+smx_activity_t SIMIX_comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data)
 {
   XBT_DEBUG("iprobe from %p %p", mbox, &mbox->comm_queue_);
   simgrid::kernel::activity::CommImplPtr this_comm;
index ae9ef01..4956544 100644 (file)
@@ -14,7 +14,6 @@ XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t
                                             int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
                                             void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
                                             double rate);
-XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type,
-                                             simix_match_func_t match_fun, void* data);
+XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_mailbox_t mbox, int type, simix_match_func_t match_fun, void* data);
 
 #endif