From: Augustin Degomme Date: Thu, 11 Sep 2014 08:53:11 +0000 (+0200) Subject: change iprobe in order to allow probing on outgoing communications (has the receive... X-Git-Tag: v3_12~833 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0c61ca197fedf0bb0f86b540e750e9da26a0bd2d?ds=sidebyside change iprobe in order to allow probing on outgoing communications (has the receive already been posted) --- diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 38a52ecafe..cdd02a8592 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -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) -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) diff --git a/src/simix/simcalls_generated_args_getter_setter.h b/src/simix/simcalls_generated_args_getter_setter.h index 6e33cecc69..9a9635eca5 100644 --- a/src/simix/simcalls_generated_args_getter_setter.h +++ b/src/simix/simcalls_generated_args_getter_setter.h @@ -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 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; } -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; } -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; } -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; } +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){ - 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){ - simcall->args[3].fp = arg; + simcall->args[4].fp = arg; } 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){ - 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; diff --git a/src/simix/simcalls_generated_body.c b/src/simix/simcalls_generated_body.c index e84f731293..218c72a227 100644 --- a/src/simix/simcalls_generated_body.c +++ b/src/simix/simcalls_generated_body.c @@ -1081,16 +1081,17 @@ } 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; - 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); diff --git a/src/simix/simcalls_generated_case.c b/src/simix/simcalls_generated_case.c index 7d413facbe..57e9938945 100644 --- a/src/simix/simcalls_generated_case.c +++ b/src/simix/simcalls_generated_case.c @@ -347,7 +347,7 @@ case SIMCALL_RDV_GET_RECEIVER: 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; diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 54eda9e942..38ba0487ca 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -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; - //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)); }*/ @@ -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, - int src, int tag, + int type, int src, int tag, 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); - 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"); - 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"); - 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--; diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index 195119bfe1..ea3095a790 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -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); -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); @@ -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_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); diff --git a/src/simix/smx_user.c b/src/simix/smx_user.c index 4ddc246d25..7a0f5d1c7d 100644 --- a/src/simix/smx_user.c +++ b/src/simix/smx_user.c @@ -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 */ -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"); - return simcall_BODY_comm_iprobe(rdv, src, tag, match_fun, data); + return simcall_BODY_comm_iprobe(rdv, type, src, tag, match_fun, data); } /** diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index ccbd02626b..52eba549df 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -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"); - 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"); - 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){