Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Distinguish access to sender-side and receiver-side user data in smx_action_t.
[simgrid.git] / src / simix / smx_user.c
index dae8115..b42fc6b 100644 (file)
@@ -268,25 +268,6 @@ void SIMIX_req_host_execution_set_priority(smx_action_t execution, double priori
   SIMIX_request_push(&req);
 }
 
   SIMIX_request_push(&req);
 }
 
-#ifdef HAVE_TRACING
-/**
- * \brief Set the category of an execution action.
- *
- * This functions changes the priority only. It calls a surf function.
- * \param execution The execution action
- * \param priority The new priority
- */
-void SIMIX_req_host_execution_set_category(smx_action_t execution, const char *category)
-{
-  s_smx_req_t req;
-
-  req.call = REQ_HOST_EXECUTION_SET_CATEGORY;
-  req.host_execution_set_category.execution = execution;
-  req.host_execution_set_category.category = xbt_strdup (category);
-  SIMIX_request_push(&req);
-}
-#endif
-
 /**
  * \brief Waits for the completion of an execution action.
  *
 /**
  * \brief Waits for the completion of an execution action.
  *
@@ -616,7 +597,8 @@ smx_action_t SIMIX_req_rdv_get_head(smx_rdv_t rdv)
 }
 
 smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate,
 }
 
 smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate,
-                              void *src_buff, size_t src_buff_size, void *data)
+                              void *src_buff, size_t src_buff_size,
+                              int (*match_fun)(void *, void *), void *data)
 {
   s_smx_req_t req;
 
 {
   s_smx_req_t req;
 
@@ -628,13 +610,15 @@ smx_action_t SIMIX_req_comm_isend(smx_rdv_t rdv, double task_size, double rate,
   req.comm_isend.rate = rate;
   req.comm_isend.src_buff = src_buff;
   req.comm_isend.src_buff_size = src_buff_size;
   req.comm_isend.rate = rate;
   req.comm_isend.src_buff = src_buff;
   req.comm_isend.src_buff_size = src_buff_size;
+  req.comm_isend.match_fun = match_fun;
   req.comm_isend.data = data;
 
   SIMIX_request_push(&req);
   return req.comm_isend.result;
 }
 
   req.comm_isend.data = data;
 
   SIMIX_request_push(&req);
   return req.comm_isend.result;
 }
 
-smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size)
+smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
+                                                                 int (*match_fun)(void *, void *), void *data)
 {
   s_smx_req_t req;
 
 {
   s_smx_req_t req;
 
@@ -644,6 +628,8 @@ smx_action_t SIMIX_req_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_bu
   req.comm_irecv.rdv = rdv;
   req.comm_irecv.dst_buff = dst_buff;
   req.comm_irecv.dst_buff_size = dst_buff_size;
   req.comm_irecv.rdv = rdv;
   req.comm_irecv.dst_buff = dst_buff;
   req.comm_irecv.dst_buff_size = dst_buff_size;
+  req.comm_irecv.match_fun = match_fun;
+  req.comm_irecv.data = data;
 
   SIMIX_request_push(&req);
   return req.comm_irecv.result;
 
   SIMIX_request_push(&req);
   return req.comm_irecv.result;
@@ -686,12 +672,11 @@ int SIMIX_req_comm_testany(xbt_dynar_t comms)
   if (xbt_dynar_length(comms)==0)
     return -1;
 
   if (xbt_dynar_length(comms)==0)
     return -1;
 
-  WARN0("SIMIX_comm_testany is not implemented yet. Using waitany instead. This changes the semantic...");
-  req.call = REQ_COMM_WAITANY;
-  req.comm_waitany.comms = comms;
+  req.call = REQ_COMM_TESTANY;
+  req.comm_testany.comms = comms;
 
   SIMIX_request_push(&req);
 
   SIMIX_request_push(&req);
-  return req.comm_waitany.result;
+  return req.comm_testany.result;
 }
 
 void SIMIX_req_comm_wait(smx_action_t comm, double timeout)
 }
 
 void SIMIX_req_comm_wait(smx_action_t comm, double timeout)
@@ -705,6 +690,26 @@ void SIMIX_req_comm_wait(smx_action_t comm, double timeout)
   SIMIX_request_push(&req);
 }
 
   SIMIX_request_push(&req);
 }
 
+#ifdef HAVE_TRACING
+/**
+ * \brief Set the category of an action.
+ *
+ * This functions changes the category only. It calls a surf function.
+ * \param execution The execution action
+ * \param category The tracing category
+ */
+void SIMIX_req_set_category(smx_action_t action, const char *category)
+{
+  s_smx_req_t req;
+
+  req.call = REQ_SET_CATEGORY;
+  req.set_category.action = action;
+  req.set_category.category = category;
+
+  SIMIX_request_push(&req);
+}
+#endif
+
 int SIMIX_req_comm_test(smx_action_t comm)
 {
   s_smx_req_t req;
 int SIMIX_req_comm_test(smx_action_t comm)
 {
   s_smx_req_t req;
@@ -738,15 +743,26 @@ e_smx_state_t SIMIX_req_comm_get_state(smx_action_t comm)
   return req.comm_get_state.result;
 }
 
   return req.comm_get_state.result;
 }
 
-void *SIMIX_req_comm_get_data(smx_action_t comm)
+void *SIMIX_req_comm_get_src_data(smx_action_t comm)
+{
+  s_smx_req_t req;
+
+  req.call = REQ_COMM_GET_SRC_DATA;
+  req.comm_get_src_data.comm = comm;
+
+  SIMIX_request_push(&req);
+  return req.comm_get_src_data.result;
+}
+
+void *SIMIX_req_comm_get_dst_data(smx_action_t comm)
 {
   s_smx_req_t req;
 
 {
   s_smx_req_t req;
 
-  req.call = REQ_COMM_GET_DATA;
-  req.comm_get_data.comm = comm;
+  req.call = REQ_COMM_GET_DST_DATA;
+  req.comm_get_dst_data.comm = comm;
 
   SIMIX_request_push(&req);
 
   SIMIX_request_push(&req);
-  return req.comm_get_data.result;
+  return req.comm_get_dst_data.result;
 }
 
 void *SIMIX_req_comm_get_src_buff(smx_action_t comm)
 }
 
 void *SIMIX_req_comm_get_src_buff(smx_action_t comm)