Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Simcall COMM_TEST is not blocking.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 08:32:34 +0000 (10:32 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Mon, 12 Apr 2021 08:32:34 +0000 (10:32 +0200)
src/kernel/activity/CommImpl.cpp
src/simix/popping_accessors.hpp
src/simix/popping_generated.cpp
src/simix/simcalls.in

index 18baf18..95f7c05 100644 (file)
@@ -223,7 +223,7 @@ void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity:
   }
 }
 
-void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm)
+bool simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm)
 {
   if ((MC_is_active() || MC_record_replay_is_active()) && comm->src_actor_ && comm->dst_actor_)
     comm->state_ = simgrid::kernel::activity::State::DONE;
@@ -231,13 +231,9 @@ void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity:
   bool res = comm->state_ != simgrid::kernel::activity::State::WAITING &&
              comm->state_ != simgrid::kernel::activity::State::RUNNING;
 
-  simcall_comm_test__set__result(simcall, res);
-  if (res) {
-    comm->simcalls_.push_back(simcall);
+  if (res)
     comm->finish();
-  } else {
-    simcall->issuer_->simcall_answer();
-  }
+  return res;
 }
 
 void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comms[], size_t count)
index 39ecf1d..0f878b0 100644 (file)
@@ -667,7 +667,7 @@ XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t re
 XBT_PRIVATE boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
 XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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, unsigned char* 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, bool detached);
-XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm);
+XBT_PRIVATE bool simcall_HANDLER_comm_test(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm);
 XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count);
 XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout);
 XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm, double timeout);
index fc87f65..36c4db8 100644 (file)
@@ -74,7 +74,8 @@ void simgrid::kernel::actor::ActorImpl::simcall_handle(int times_considered)
       break;
 
     case Simcall::COMM_TEST:
-      simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]));
+      simgrid::simix::marshal<bool>(simcall_.result_, simcall_HANDLER_comm_test(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0])));
+      simcall_answer();
       break;
 
     case Simcall::COMM_TESTANY:
index 405056c..e745724 100644 (file)
@@ -39,7 +39,7 @@ void           comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char
 boost::intrusive_ptr<simgrid::kernel::activity::ActivityImpl> comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, unsigned char* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double rate);
 void           comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, unsigned char* 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, unsigned char* 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, bool detached);
-bool           comm_test(simgrid::kernel::activity::CommImpl* comm) [[block]];
+bool           comm_test(simgrid::kernel::activity::CommImpl* comm);
 int            comm_testany(simgrid::kernel::activity::CommImpl** comms, size_t count) [[block]];
 int            comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) [[block]];
 void           comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout) [[block]];