Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
RemotePtr in get_comm_wait_raw_addr()
[simgrid.git] / src / mc / checker / CommunicationDeterminismChecker.cpp
index 96fb9045fed3244a2a9ea4f2fe72c2ec70535b40..5a588d64f923fe3e38366bef6449a988f34d4381 100644 (file)
@@ -111,18 +111,17 @@ static char* print_determinism_result(simgrid::mc::CommPatternDifference diff, a
 }
 
 static void update_comm_pattern(simgrid::mc::PatternCommunication* comm_pattern,
-                                const simgrid::kernel::activity::CommImpl* comm_addr)
+                                simgrid::mc::RemotePtr<simgrid::kernel::activity::CommImpl> const& comm_addr)
 {
-  auto src_proc = api::get().get_src_actor(comm_addr);
-  auto dst_proc = api::get().get_dst_actor(comm_addr);
+  auto src_proc = api::get().get_src_actor(comm_addr.local());
+  auto dst_proc = api::get().get_dst_actor(comm_addr.local());
   comm_pattern->src_proc = src_proc->get_pid();
   comm_pattern->dst_proc = dst_proc->get_pid();
   comm_pattern->src_host = api::get().get_actor_host_name(src_proc);
   comm_pattern->dst_host = api::get().get_actor_host_name(dst_proc);
 
   if (comm_pattern->data.empty()) {
-    auto comm = const_cast<simgrid::kernel::activity::CommImpl*>(comm_addr);
-    comm_pattern->data = api::get().get_pattern_comm_data(simgrid::mc::remote(comm));
+    comm_pattern->data = api::get().get_pattern_comm_data(comm_addr);
   }
 }
 
@@ -194,7 +193,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, Ca
     pattern->type      = PatternCommunicationType::send;
     pattern->comm_addr = api::get().get_comm_isend_raw_addr(request).local();
     pattern->rdv      = api::get().get_pattern_comm_rdv(remote(pattern->comm_addr));
-    pattern->src_proc = api::get().get_pattern_comm_src_proc(pattern->comm_addr);
+    pattern->src_proc = api::get().get_pattern_comm_src_proc(remote(pattern->comm_addr));
     pattern->src_host = Api::get().get_actor_host_name(issuer);
 
 #if HAVE_SMPI
@@ -225,7 +224,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, Ca
 #endif
     auto comm_addr = pattern->comm_addr;
     pattern->rdv = api::get().get_pattern_comm_rdv(remote(comm_addr));
-    pattern->dst_proc = api::get().get_pattern_comm_dst_proc(comm_addr);
+    pattern->dst_proc = api::get().get_pattern_comm_dst_proc(remote(comm_addr));
     pattern->dst_host = api::get().get_actor_host_name(issuer);
   } else
     xbt_die("Unexpected call_type %i", (int)call_type);
@@ -234,18 +233,18 @@ void CommunicationDeterminismChecker::get_comm_pattern(smx_simcall_t request, Ca
   incomplete_communications_pattern[issuer->get_pid()].push_back(pattern.release());
 }
 
-void CommunicationDeterminismChecker::complete_comm_pattern(const kernel::activity::CommImpl* comm_addr, aid_t issuer,
+void CommunicationDeterminismChecker::complete_comm_pattern(RemotePtr<kernel::activity::CommImpl> const& comm_addr, aid_t issuer,
                                                             int backtracking)
 {
   /* Complete comm pattern */
   std::vector<PatternCommunication*>& incomplete_pattern = incomplete_communications_pattern[issuer];
   auto current_comm_pattern =
       std::find_if(begin(incomplete_pattern), end(incomplete_pattern),
-                   [&comm_addr](const PatternCommunication* comm) { return api::get().comm_addr_equal(comm->comm_addr, comm_addr); });
+                   [&comm_addr](const PatternCommunication* comm) { return api::get().comm_addr_equal(comm->comm_addr, comm_addr.local()); });
   if (current_comm_pattern == std::end(incomplete_pattern))
     xbt_die("Corresponding communication not found!");
 
-  update_comm_pattern(*current_comm_pattern, comm_addr);
+  update_comm_pattern(*current_comm_pattern, remote(comm_addr.local()));
   std::unique_ptr<PatternCommunication> comm_pattern(*current_comm_pattern);
   XBT_DEBUG("Remove incomplete comm pattern for process %ld at cursor %zd", issuer,
             std::distance(begin(incomplete_pattern), current_comm_pattern));
@@ -400,11 +399,11 @@ void CommunicationDeterminismChecker::handle_comm_pattern(simgrid::mc::CallType
       break;
     case CallType::WAIT:
     case CallType::WAITANY: {
-      const simgrid::kernel::activity::CommImpl* comm_addr = nullptr;
+      RemotePtr<simgrid::kernel::activity::CommImpl> comm_addr;
       if (call_type == CallType::WAIT)
         comm_addr = api::get().get_comm_wait_raw_addr(req);
       else
-        comm_addr = api::get().get_comm_waitany_raw_addr(req, value);
+        comm_addr = remote(api::get().get_comm_waitany_raw_addr(req, value));
       auto simcall_issuer = api::get().simcall_get_issuer(req);
       complete_comm_pattern(comm_addr, simcall_issuer->get_pid(), backtracking);
     } break;