Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
change iprobe in order to allow probing on outgoing communications (has the receive...
authorAugustin Degomme <augustin.degomme@imag.fr>
Thu, 11 Sep 2014 08:53:11 +0000 (10:53 +0200)
committerAugustin Degomme <augustin.degomme@imag.fr>
Thu, 11 Sep 2014 12:24:49 +0000 (14:24 +0200)
src/simix/simcalls.in
src/simix/simcalls_generated_args_getter_setter.h
src/simix/simcalls_generated_body.c
src/simix/simcalls_generated_case.c
src/simix/smx_network.c
src/simix/smx_network_private.h
src/simix/smx_user.c
src/smpi/smpi_base.c

index 38a52ec..cdd02a8 100644 (file)
@@ -75,7 +75,7 @@ rdv_comm_count_by_host True (unsigned int) (rdv, void*, smx_rdv_t) (host, void*,
 rdv_get_head True (void*, smx_action_t) (rdv, void*, smx_rdv_t)
 rdv_set_receiver True (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t)
 rdv_get_receiver True (void*, smx_process_t) (rdv, void*, smx_rdv_t)
 rdv_get_head True (void*, smx_action_t) (rdv, void*, smx_rdv_t)
 rdv_set_receiver True (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t)
 rdv_get_receiver True (void*, smx_process_t) (rdv, void*, smx_rdv_t)
-comm_iprobe True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
+comm_iprobe True (void*, smx_action_t) (rdv, void*, smx_rdv_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*)
 comm_send False (void) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t)  (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double)
 comm_isend True (void*, smx_action_t) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int)
 comm_recv False (void) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double)
 comm_send False (void) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t)  (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double)
 comm_isend True (void*, smx_action_t) (src, void*, smx_process_t) (rdv, void*, smx_rdv_t) (task_size, double) (rate, double) (src_buff, void*) (src_buff_size, size_t) (match_fun, FPtr, simix_match_func_t) (clean_fun, FPtr, simix_clean_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (detached, int)
 comm_recv False (void) (rdv, void*, smx_rdv_t) (dst_buff, void*) (dst_buff_size, void*, size_t*) (match_fun, FPtr, simix_match_func_t) (copy_data_fun, FPtr, simix_copy_data_func_t) (data, void*) (timeout, double) (rate, double)
index 6e33cec..9a9635e 100644 (file)
@@ -666,29 +666,35 @@ static inline smx_rdv_t simcall_comm_iprobe__get__rdv(smx_simcall_t simcall){
 static inline void simcall_comm_iprobe__set__rdv(smx_simcall_t simcall, void* arg){
     simcall->args[0].dp = arg;
 }
 static inline void simcall_comm_iprobe__set__rdv(smx_simcall_t simcall, void* arg){
     simcall->args[0].dp = arg;
 }
-static inline int simcall_comm_iprobe__get__src(smx_simcall_t simcall){
+static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall){
   return  simcall->args[1].i;
 }
   return  simcall->args[1].i;
 }
-static inline void simcall_comm_iprobe__set__src(smx_simcall_t simcall, int arg){
+static inline void simcall_comm_iprobe__set__type(smx_simcall_t simcall, int arg){
     simcall->args[1].i = arg;
 }
     simcall->args[1].i = arg;
 }
-static inline int simcall_comm_iprobe__get__tag(smx_simcall_t simcall){
+static inline int simcall_comm_iprobe__get__src(smx_simcall_t simcall){
   return  simcall->args[2].i;
 }
   return  simcall->args[2].i;
 }
-static inline void simcall_comm_iprobe__set__tag(smx_simcall_t simcall, int arg){
+static inline void simcall_comm_iprobe__set__src(smx_simcall_t simcall, int arg){
     simcall->args[2].i = arg;
 }
     simcall->args[2].i = arg;
 }
+static inline int simcall_comm_iprobe__get__tag(smx_simcall_t simcall){
+  return  simcall->args[3].i;
+}
+static inline void simcall_comm_iprobe__set__tag(smx_simcall_t simcall, int arg){
+    simcall->args[3].i = arg;
+}
 static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall){
 static inline simix_match_func_t simcall_comm_iprobe__get__match_fun(smx_simcall_t simcall){
-  return (simix_match_func_t) simcall->args[3].fp;
+  return (simix_match_func_t) simcall->args[4].fp;
 }
 static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, FPtr arg){
 }
 static inline void simcall_comm_iprobe__set__match_fun(smx_simcall_t simcall, FPtr arg){
-    simcall->args[3].fp = arg;
+    simcall->args[4].fp = arg;
 }
 static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall){
 }
 static inline void* simcall_comm_iprobe__get__data(smx_simcall_t simcall){
-  return  simcall->args[4].dp;
+  return  simcall->args[5].dp;
 }
 static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg){
 }
 static inline void simcall_comm_iprobe__set__data(smx_simcall_t simcall, void* arg){
-    simcall->args[4].dp = arg;
+    simcall->args[5].dp = arg;
 }
 static inline smx_process_t simcall_comm_send__get__src(smx_simcall_t simcall){
   return (smx_process_t) simcall->args[0].dp;
 }
 static inline smx_process_t simcall_comm_send__get__src(smx_simcall_t simcall){
   return (smx_process_t) simcall->args[0].dp;
index e84f731..218c72a 100644 (file)
     }    
     return self->simcall.result.dp;
   }
     }    
     return self->simcall.result.dp;
   }
-  inline static smx_action_t simcall_BODY_comm_iprobe(smx_rdv_t rdv, int src, int tag, simix_match_func_t match_fun, void* data) {
+  inline static smx_action_t simcall_BODY_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data) {
     smx_process_t self = SIMIX_process_self();
     self->simcall.call = SIMCALL_COMM_IPROBE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) rdv;
     smx_process_t self = SIMIX_process_self();
     self->simcall.call = SIMCALL_COMM_IPROBE;
     memset(&self->simcall.result, 0, sizeof(self->simcall.result));
     memset(self->simcall.args, 0, sizeof(self->simcall.args));
     self->simcall.args[0].dp = (void*) rdv;
-    self->simcall.args[1].i = (int) src;
-    self->simcall.args[2].i = (int) tag;
-    self->simcall.args[3].fp = (FPtr) match_fun;
-    self->simcall.args[4].dp = (void*) data;
+    self->simcall.args[1].i = (int) type;
+    self->simcall.args[2].i = (int) src;
+    self->simcall.args[3].i = (int) tag;
+    self->simcall.args[4].fp = (FPtr) match_fun;
+    self->simcall.args[5].dp = (void*) data;
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
     if (self != simix_global->maestro_process) {
       XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
                 SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
index 7d413fa..57e9938 100644 (file)
@@ -347,7 +347,7 @@ case SIMCALL_RDV_GET_RECEIVER:
       break;  
 
 case SIMCALL_COMM_IPROBE:
       break;  
 
 case SIMCALL_COMM_IPROBE:
-      simcall->result.dp = SIMIX_pre_comm_iprobe(simcall , (smx_rdv_t) simcall->args[0].dp,  simcall->args[1].i,  simcall->args[2].i, (simix_match_func_t) simcall->args[3].fp,  simcall->args[4].dp);
+      simcall->result.dp = SIMIX_pre_comm_iprobe(simcall , (smx_rdv_t) simcall->args[0].dp,  simcall->args[1].i,  simcall->args[2].i,  simcall->args[3].i, (simix_match_func_t) simcall->args[4].fp,  simcall->args[5].dp);
       SIMIX_simcall_answer(simcall);
       break;  
 
       SIMIX_simcall_answer(simcall);
       break;  
 
index 54eda9e..38ba048 100644 (file)
@@ -506,10 +506,6 @@ smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
         other_action->state = SIMIX_DONE;
         other_action->comm.type = SIMIX_COMM_DONE;
         other_action->comm.rdv = NULL;
         other_action->state = SIMIX_DONE;
         other_action->comm.type = SIMIX_COMM_DONE;
         other_action->comm.rdv = NULL;
-        //SIMIX_comm_destroy(this_action);
-        //--smx_total_comms; // this creation was a pure waste
-        //already_received=1;
-        //other_action->comm.refcount--;
       }/*else{
          XBT_DEBUG("Not yet finished, we have to wait %d\n", xbt_fifo_size(rdv->comm_fifo));
          }*/
       }/*else{
          XBT_DEBUG("Not yet finished, we have to wait %d\n", xbt_fifo_size(rdv->comm_fifo));
          }*/
@@ -569,29 +565,36 @@ smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
 }
 
 smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
 }
 
 smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
-                                   int src, int tag,
+                                   int type, int src, int tag,
                                    int (*match_fun)(void *, void *, smx_action_t),
                                    void *data){
                                    int (*match_fun)(void *, void *, smx_action_t),
                                    void *data){
-  return SIMIX_comm_iprobe(simcall->issuer, rdv, src, tag, match_fun, data);
+  return SIMIX_comm_iprobe(simcall->issuer, rdv, type, src, tag, match_fun, data);
 }
 
 }
 
-smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
+smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src,
                               int tag, int (*match_fun)(void *, void *, smx_action_t), void *data)
 {
   XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
                               int tag, int (*match_fun)(void *, void *, smx_action_t), void *data)
 {
   XBT_DEBUG("iprobe from %p %p\n", rdv, rdv->comm_fifo);
-  smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
-
+  smx_action_t this_action;
+  int smx_type;
+  if(type == 1){
+    this_action=SIMIX_comm_new(SIMIX_COMM_SEND);
+    smx_type = SIMIX_COMM_RECEIVE;
+  } else{
+    this_action=SIMIX_comm_new(SIMIX_COMM_RECEIVE);
+    smx_type = SIMIX_COMM_SEND;
+  } 
   smx_action_t other_action=NULL;
   if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
     //find a match in the already received fifo
       XBT_DEBUG("first try in the perm recv mailbox \n");
 
   smx_action_t other_action=NULL;
   if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){
     //find a match in the already received fifo
       XBT_DEBUG("first try in the perm recv mailbox \n");
 
-    other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
+    other_action = SIMIX_fifo_probe_comm(rdv->done_comm_fifo, smx_type, match_fun, data, this_action);
   }
  // }else{
     if(!other_action){
         XBT_DEBUG("second try in the other mailbox");
   }
  // }else{
     if(!other_action){
         XBT_DEBUG("second try in the other mailbox");
-        other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_action);
+        other_action = SIMIX_fifo_probe_comm(rdv->comm_fifo, smx_type, match_fun, data, this_action);
     }
 //  }
   if(other_action)other_action->comm.refcount--;
     }
 //  }
   if(other_action)other_action->comm.refcount--;
index 195119b..ea3095a 100644 (file)
@@ -49,7 +49,7 @@ smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
                               void *data, double rate);
 void SIMIX_comm_destroy(smx_action_t action);
 void SIMIX_comm_destroy_internal_actions(smx_action_t action);
                               void *data, double rate);
 void SIMIX_comm_destroy(smx_action_t action);
 void SIMIX_comm_destroy_internal_actions(smx_action_t action);
-smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
+smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int type, int src,
                               int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
 void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
 void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
                               int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
 void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
 void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
@@ -65,8 +65,8 @@ smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
 smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
 
 // pre prototypes
 smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
 
 // pre prototypes
-smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
-                                   int src, int tag,
+smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, 
+                                   int type,int src, int tag,
                                    int (*match_fun)(void *, void *, smx_action_t),
                                    void *data);
 smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
                                    int (*match_fun)(void *, void *, smx_action_t),
                                    void *data);
 smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
index 4ddc246..7a0f5d1 100644 (file)
@@ -1023,12 +1023,12 @@ smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_
 /**
  * \ingroup simix_comm_management
  */
 /**
  * \ingroup simix_comm_management
  */
-smx_action_t simcall_comm_iprobe(smx_rdv_t rdv, int src, int tag,
+smx_action_t simcall_comm_iprobe(smx_rdv_t rdv, int type, int src, int tag,
                                 int (*match_fun)(void *, void *, smx_action_t), void *data)
 {
   xbt_assert(rdv, "No rendez-vous point defined for iprobe");
 
                                 int (*match_fun)(void *, void *, smx_action_t), void *data)
 {
   xbt_assert(rdv, "No rendez-vous point defined for iprobe");
 
-  return simcall_BODY_comm_iprobe(rdv, src, tag, match_fun, data);
+  return simcall_BODY_comm_iprobe(rdv, type, src, tag, match_fun, data);
 }
 
 /**
 }
 
 /**
index ccbd026..52eba54 100644 (file)
@@ -819,12 +819,12 @@ void smpi_mpi_iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status*
     if (sg_cfg_get_int("smpi/async_small_thres")>0){
         mailbox = smpi_process_mailbox_small();
         XBT_DEBUG("trying to probe the perm recv mailbox");
     if (sg_cfg_get_int("smpi/async_small_thres")>0){
         mailbox = smpi_process_mailbox_small();
         XBT_DEBUG("trying to probe the perm recv mailbox");
-        request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
+        request->action = simcall_comm_iprobe(mailbox, 0, request->src, request->tag, &match_recv, (void*)request);
     }
     if (request->action==NULL){
        mailbox = smpi_process_mailbox();
         XBT_DEBUG("trying to probe the other mailbox");
     }
     if (request->action==NULL){
        mailbox = smpi_process_mailbox();
         XBT_DEBUG("trying to probe the other mailbox");
-        request->action = simcall_comm_iprobe(mailbox, request->src, request->tag, &match_recv, (void*)request);
+        request->action = simcall_comm_iprobe(mailbox, 0, request->src,request->tag, &match_recv, (void*)request);
     }
 
   if(request->action){
     }
 
   if(request->action){