From: Martin Quinson Date: Sun, 16 Aug 2015 16:31:54 +0000 (+0200) Subject: uniformize simcall_comm_send() and simcall_comm_recv() X-Git-Tag: v3_12~306 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/f42adf142a13496847719d181df45ac2915e8630 uniformize simcall_comm_send() and simcall_comm_recv() Recv now takes the receiver as first argument, and it should be able to receive on a remote process. I tried to remove the sender argument out of send(), but it's used in SMPI when using RMA and I don't want to dig into it today. --- diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index d79ac02a99..70fc02cba3 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -417,14 +417,14 @@ XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void); /***** Communication simcalls *****/ -XBT_PUBLIC(void) simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, +XBT_PUBLIC(void) simcall_comm_send(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout); -XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, +XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, @@ -433,13 +433,13 @@ XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached); -XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, +XBT_PUBLIC(void) simcall_comm_recv(smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate); -XBT_PUBLIC(smx_synchro_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, +XBT_PUBLIC(smx_synchro_t) simcall_comm_irecv(smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), diff --git a/src/msg/msg_gos.c b/src/msg/msg_gos.c index 92e78159db..7b0f6ee130 100644 --- a/src/msg/msg_gos.c +++ b/src/msg/msg_gos.c @@ -586,7 +586,7 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, comm->task_sent = NULL; comm->task_received = task; comm->status = MSG_OK; - comm->s_comm = simcall_comm_irecv(rdv, task, NULL, NULL, NULL, NULL, rate); + comm->s_comm = simcall_comm_irecv(MSG_process_self(), rdv, task, NULL, NULL, NULL, NULL, rate); return comm; } diff --git a/src/msg/msg_mailbox.c b/src/msg/msg_mailbox.c index 7b2301fd60..b3a2234850 100644 --- a/src/msg/msg_mailbox.c +++ b/src/msg/msg_mailbox.c @@ -128,7 +128,7 @@ MSG_mailbox_get_task_ext_bounded(msg_mailbox_t mailbox, msg_task_t * task, /* Try to receive it by calling SIMIX network layer */ TRY { - simcall_comm_recv(mailbox, task, NULL, NULL, NULL, NULL, timeout, rate); + simcall_comm_recv(MSG_process_self(), mailbox, task, NULL, NULL, NULL, NULL, timeout, rate); XBT_DEBUG("Got task %s from %p",(*task)->name,mailbox); if (msg_global->debug_multiple_use && (*task)->simdata->isused!=0) xbt_ex_free(*(xbt_ex_t*)(*task)->simdata->isused); diff --git a/src/simix/libsmx.c b/src/simix/libsmx.c index bd862a37f3..25285dc873 100644 --- a/src/simix/libsmx.c +++ b/src/simix/libsmx.c @@ -950,7 +950,7 @@ smx_process_t simcall_rdv_get_receiver(smx_rdv_t rdv) /** * \ingroup simix_comm_management */ -void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, +void simcall_comm_send(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, @@ -966,13 +966,13 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ - comm = simcall_comm_isend(src, rdv, task_size, rate, + comm = simcall_comm_isend(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0); simcall_comm_wait(comm, timeout); comm = NULL; } else { - simcall_BODY_comm_send(src, rdv, task_size, rate, src_buff, src_buff_size, + simcall_BODY_comm_send(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); } } @@ -980,7 +980,7 @@ void simcall_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, doubl /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, +smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*clean_fun)(void *), @@ -994,7 +994,7 @@ smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_s xbt_assert(rdv, "No rendez-vous point defined for isend"); - return simcall_BODY_comm_isend(src, rdv, task_size, rate, src_buff, + return simcall_BODY_comm_isend(sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); } @@ -1002,7 +1002,7 @@ smx_synchro_t simcall_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_s /** * \ingroup simix_comm_management */ -void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, +void simcall_comm_recv(smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate) @@ -1013,27 +1013,27 @@ void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size, if (MC_is_active() || MC_record_replay_is_active()) { /* the model-checker wants two separate simcalls */ smx_synchro_t comm = NULL; /* MC needs the comm to be set to NULL during the simcall */ - comm = simcall_comm_irecv(rdv, dst_buff, dst_buff_size, + comm = simcall_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); simcall_comm_wait(comm, timeout); comm = NULL; } else { - simcall_BODY_comm_recv(rdv, dst_buff, dst_buff_size, + simcall_BODY_comm_recv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); } } /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, +smx_synchro_t simcall_comm_irecv(smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate) { xbt_assert(rdv, "No rendez-vous point defined for irecv"); - return simcall_BODY_comm_irecv(rdv, dst_buff, dst_buff_size, + return simcall_BODY_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index 253b120b90..75b3d05a08 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -1053,10 +1053,10 @@ static inline void simcall_comm_iprobe__set__result(smx_simcall_t simcall, void* simcall->result.dp = result; } -static inline smx_process_t simcall_comm_send__get__src(smx_simcall_t simcall) { +static inline smx_process_t simcall_comm_send__get__sender(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_comm_send__set__src(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_send__set__sender(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } static inline smx_rdv_t simcall_comm_send__get__rdv(smx_simcall_t simcall) { @@ -1114,10 +1114,10 @@ static inline void simcall_comm_send__set__timeout(smx_simcall_t simcall, double simcall->args[9].d = arg; } -static inline smx_process_t simcall_comm_isend__get__src(smx_simcall_t simcall) { +static inline smx_process_t simcall_comm_isend__get__sender(smx_simcall_t simcall) { return (smx_process_t) simcall->args[0].dp; } -static inline void simcall_comm_isend__set__src(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_isend__set__sender(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } static inline smx_rdv_t simcall_comm_isend__get__rdv(smx_simcall_t simcall) { @@ -1187,96 +1187,108 @@ static inline void simcall_comm_isend__set__result(smx_simcall_t simcall, void* simcall->result.dp = result; } +static inline smx_process_t simcall_comm_recv__get__receiver(smx_simcall_t simcall) { + return (smx_process_t) simcall->args[0].dp; +} +static inline void simcall_comm_recv__set__receiver(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} static inline smx_rdv_t simcall_comm_recv__get__rdv(smx_simcall_t simcall) { - return (smx_rdv_t) simcall->args[0].dp; + return (smx_rdv_t) simcall->args[1].dp; } static inline void simcall_comm_recv__set__rdv(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; + simcall->args[1].dp = arg; } static inline void* simcall_comm_recv__get__dst_buff(smx_simcall_t simcall) { - return simcall->args[1].dp; + return simcall->args[2].dp; } static inline void simcall_comm_recv__set__dst_buff(smx_simcall_t simcall, void* arg) { - simcall->args[1].dp = arg; + simcall->args[2].dp = arg; } static inline size_t* simcall_comm_recv__get__dst_buff_size(smx_simcall_t simcall) { - return (size_t*) simcall->args[2].dp; + return (size_t*) simcall->args[3].dp; } static inline void simcall_comm_recv__set__dst_buff_size(smx_simcall_t simcall, void* arg) { - simcall->args[2].dp = arg; + simcall->args[3].dp = arg; } static inline simix_match_func_t simcall_comm_recv__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_recv__set__match_fun(smx_simcall_t simcall, FPtr arg) { - simcall->args[3].fp = arg; + simcall->args[4].fp = arg; } static inline simix_copy_data_func_t simcall_comm_recv__get__copy_data_fun(smx_simcall_t simcall) { - return (simix_copy_data_func_t) simcall->args[4].fp; + return (simix_copy_data_func_t) simcall->args[5].fp; } static inline void simcall_comm_recv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { - simcall->args[4].fp = arg; + simcall->args[5].fp = arg; } static inline void* simcall_comm_recv__get__data(smx_simcall_t simcall) { - return simcall->args[5].dp; + return simcall->args[6].dp; } static inline void simcall_comm_recv__set__data(smx_simcall_t simcall, void* arg) { - simcall->args[5].dp = arg; + simcall->args[6].dp = arg; } static inline double simcall_comm_recv__get__timeout(smx_simcall_t simcall) { - return simcall->args[6].d; + return simcall->args[7].d; } static inline void simcall_comm_recv__set__timeout(smx_simcall_t simcall, double arg) { - simcall->args[6].d = arg; + simcall->args[7].d = arg; } static inline double simcall_comm_recv__get__rate(smx_simcall_t simcall) { - return simcall->args[7].d; + return simcall->args[8].d; } static inline void simcall_comm_recv__set__rate(smx_simcall_t simcall, double arg) { - simcall->args[7].d = arg; + simcall->args[8].d = arg; } +static inline smx_process_t simcall_comm_irecv__get__receiver(smx_simcall_t simcall) { + return (smx_process_t) simcall->args[0].dp; +} +static inline void simcall_comm_irecv__set__receiver(smx_simcall_t simcall, void* arg) { + simcall->args[0].dp = arg; +} static inline smx_rdv_t simcall_comm_irecv__get__rdv(smx_simcall_t simcall) { - return (smx_rdv_t) simcall->args[0].dp; + return (smx_rdv_t) simcall->args[1].dp; } static inline void simcall_comm_irecv__set__rdv(smx_simcall_t simcall, void* arg) { - simcall->args[0].dp = arg; + simcall->args[1].dp = arg; } static inline void* simcall_comm_irecv__get__dst_buff(smx_simcall_t simcall) { - return simcall->args[1].dp; + return simcall->args[2].dp; } static inline void simcall_comm_irecv__set__dst_buff(smx_simcall_t simcall, void* arg) { - simcall->args[1].dp = arg; + simcall->args[2].dp = arg; } static inline size_t* simcall_comm_irecv__get__dst_buff_size(smx_simcall_t simcall) { - return (size_t*) simcall->args[2].dp; + return (size_t*) simcall->args[3].dp; } static inline void simcall_comm_irecv__set__dst_buff_size(smx_simcall_t simcall, void* arg) { - simcall->args[2].dp = arg; + simcall->args[3].dp = arg; } static inline simix_match_func_t simcall_comm_irecv__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_irecv__set__match_fun(smx_simcall_t simcall, FPtr arg) { - simcall->args[3].fp = arg; + simcall->args[4].fp = arg; } static inline simix_copy_data_func_t simcall_comm_irecv__get__copy_data_fun(smx_simcall_t simcall) { - return (simix_copy_data_func_t) simcall->args[4].fp; + return (simix_copy_data_func_t) simcall->args[5].fp; } static inline void simcall_comm_irecv__set__copy_data_fun(smx_simcall_t simcall, FPtr arg) { - simcall->args[4].fp = arg; + simcall->args[5].fp = arg; } static inline void* simcall_comm_irecv__get__data(smx_simcall_t simcall) { - return simcall->args[5].dp; + return simcall->args[6].dp; } static inline void simcall_comm_irecv__set__data(smx_simcall_t simcall, void* arg) { - simcall->args[5].dp = arg; + simcall->args[6].dp = arg; } static inline double simcall_comm_irecv__get__rate(smx_simcall_t simcall) { - return simcall->args[6].d; + return simcall->args[7].d; } static inline void simcall_comm_irecv__set__rate(smx_simcall_t simcall, double arg) { - simcall->args[6].d = arg; + simcall->args[7].d = arg; } static inline smx_synchro_t simcall_comm_irecv__get__result(smx_simcall_t simcall){ return (smx_synchro_t) simcall->result.dp; @@ -1948,10 +1960,10 @@ smx_synchro_t simcall_HANDLER_process_execute(smx_simcall_t simcall, const char* void simcall_HANDLER_process_execution_wait(smx_simcall_t simcall, smx_synchro_t execution); smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process); smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data); -void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* 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); -smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* 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, int detached); -void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate); -smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, void* 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 simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void* 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); +smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void* 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, int detached); +void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate); +smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_process_t receiver, smx_rdv_t rdv, void* 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 simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t comms); void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t comm, double timeout); void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t comm); diff --git a/src/simix/popping_bodies.c b/src/simix/popping_bodies.c index 817100de37..2aa5171322 100644 --- a/src/simix/popping_bodies.c +++ b/src/simix/popping_bodies.c @@ -1598,17 +1598,17 @@ inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_rdv_t rdv, int type, in return self->simcall.result.dp; } -inline static void simcall_BODY_comm_send(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* 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) { +inline static void simcall_BODY_comm_send(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void* 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) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_comm_send(&self->simcall, src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); + if (0) simcall_HANDLER_comm_send(&self->simcall, sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ self->simcall.call = SIMCALL_COMM_SEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) src; + self->simcall.args[0].dp = (void*) sender; self->simcall.args[1].dp = (void*) rdv; self->simcall.args[2].d = (double) task_size; self->simcall.args[3].d = (double) rate; @@ -1628,17 +1628,17 @@ inline static void simcall_BODY_comm_send(smx_process_t src, smx_rdv_t rdv, doub } -inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t src, smx_rdv_t rdv, double task_size, double rate, void* 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, int detached) { +inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t sender, smx_rdv_t rdv, double task_size, double rate, void* 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, int detached) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_comm_isend(&self->simcall, src, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); + if (0) simcall_HANDLER_comm_isend(&self->simcall, sender, rdv, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ self->simcall.call = SIMCALL_COMM_ISEND; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); - self->simcall.args[0].dp = (void*) src; + self->simcall.args[0].dp = (void*) sender; self->simcall.args[1].dp = (void*) rdv; self->simcall.args[2].d = (double) task_size; self->simcall.args[3].d = (double) rate; @@ -1659,24 +1659,25 @@ inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t src, smx_rdv_t return self->simcall.result.dp; } -inline static void simcall_BODY_comm_recv(smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) { +inline static void simcall_BODY_comm_recv(smx_process_t receiver, smx_rdv_t rdv, void* dst_buff, size_t* dst_buff_size, simix_match_func_t match_fun, simix_copy_data_func_t copy_data_fun, void* data, double timeout, double rate) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_comm_recv(&self->simcall, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); + if (0) simcall_HANDLER_comm_recv(&self->simcall, receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ self->simcall.call = SIMCALL_COMM_RECV; 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].dp = (void*) dst_buff; - self->simcall.args[2].dp = (void*) dst_buff_size; - self->simcall.args[3].fp = (FPtr) match_fun; - self->simcall.args[4].fp = (FPtr) copy_data_fun; - self->simcall.args[5].dp = (void*) data; - self->simcall.args[6].d = (double) timeout; - self->simcall.args[7].d = (double) rate; + self->simcall.args[0].dp = (void*) receiver; + self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[2].dp = (void*) dst_buff; + self->simcall.args[3].dp = (void*) dst_buff_size; + self->simcall.args[4].fp = (FPtr) match_fun; + self->simcall.args[5].fp = (FPtr) copy_data_fun; + self->simcall.args[6].dp = (void*) data; + self->simcall.args[7].d = (double) timeout; + self->simcall.args[8].d = (double) rate; 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); @@ -1687,23 +1688,24 @@ inline static void simcall_BODY_comm_recv(smx_rdv_t rdv, void* dst_buff, size_t* } -inline static smx_synchro_t simcall_BODY_comm_irecv(smx_rdv_t rdv, void* 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) { +inline static smx_synchro_t simcall_BODY_comm_irecv(smx_process_t receiver, smx_rdv_t rdv, void* 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) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) simcall_HANDLER_comm_irecv(&self->simcall, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); + if (0) simcall_HANDLER_comm_irecv(&self->simcall, receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ self->simcall.call = SIMCALL_COMM_IRECV; 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].dp = (void*) dst_buff; - self->simcall.args[2].dp = (void*) dst_buff_size; - self->simcall.args[3].fp = (FPtr) match_fun; - self->simcall.args[4].fp = (FPtr) copy_data_fun; - self->simcall.args[5].dp = (void*) data; - self->simcall.args[6].d = (double) rate; + self->simcall.args[0].dp = (void*) receiver; + self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[2].dp = (void*) dst_buff; + self->simcall.args[3].dp = (void*) dst_buff_size; + self->simcall.args[4].fp = (FPtr) match_fun; + self->simcall.args[5].fp = (FPtr) copy_data_fun; + self->simcall.args[6].dp = (void*) data; + self->simcall.args[7].d = (double) rate; 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/popping_generated.c b/src/simix/popping_generated.c index 24b9f74b75..76752d7792 100644 --- a/src/simix/popping_generated.c +++ b/src/simix/popping_generated.c @@ -538,11 +538,11 @@ case SIMCALL_COMM_ISEND: break; case SIMCALL_COMM_RECV: - simcall_HANDLER_comm_recv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d, simcall->args[7].d); + simcall_HANDLER_comm_recv(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].dp, (size_t*) simcall->args[3].dp, (simix_match_func_t) simcall->args[4].fp, (simix_copy_data_func_t) simcall->args[5].fp, simcall->args[6].dp, simcall->args[7].d, simcall->args[8].d); break; case SIMCALL_COMM_IRECV: - simcall->result.dp = simcall_HANDLER_comm_irecv(simcall , (smx_rdv_t) simcall->args[0].dp, simcall->args[1].dp, (size_t*) simcall->args[2].dp, (simix_match_func_t) simcall->args[3].fp, (simix_copy_data_func_t) simcall->args[4].fp, simcall->args[5].dp, simcall->args[6].d); + simcall->result.dp = simcall_HANDLER_comm_irecv(simcall , (smx_process_t) simcall->args[0].dp, (smx_rdv_t) simcall->args[1].dp, simcall->args[2].dp, (size_t*) simcall->args[3].dp, (simix_match_func_t) simcall->args[4].fp, (simix_copy_data_func_t) simcall->args[5].fp, simcall->args[6].dp, simcall->args[7].d); SIMIX_simcall_answer(simcall); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 5a412c9396..2ada8283a8 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -123,10 +123,10 @@ Func - rdv_get_head (void*, smx_synchro_t) (rdv, void*, smx_rdv_t) Proc - rdv_set_receiver (void) (rdv, void*, smx_rdv_t) (receiver, void*, smx_process_t) Func - rdv_get_receiver (void*, smx_process_t) (rdv, void*, smx_rdv_t) Func H comm_iprobe (void*, smx_synchro_t) (rdv, void*, smx_rdv_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*) -Blck H comm_send (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) -Func H comm_isend (void*, smx_synchro_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) -Blck H comm_recv (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) -Func H comm_irecv (void*, smx_synchro_t) (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*) (rate, double) +Blck H comm_send (void) (sender, 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) +Func H comm_isend (void*, smx_synchro_t) (sender, 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) +Blck H comm_recv (void) (receiver, void*, smx_process_t) (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) +Func H comm_irecv (void*, smx_synchro_t) (receiver, void*, smx_process_t) (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*) (rate, double) Proc - comm_cancel (void) (comm, void*, smx_synchro_t) Blck H comm_waitany (int) (comms, void*, xbt_dynar_t) Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double) diff --git a/src/simix/smx_network.c b/src/simix/smx_network.c index 78a4922666..da8704f48d 100644 --- a/src/simix/smx_network.c +++ b/src/simix/smx_network.c @@ -418,25 +418,25 @@ smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sr return (detached ? NULL : other_synchro); } -void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv, +void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double timeout, double rate) { - smx_synchro_t comm = SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, + smx_synchro_t comm = SIMIX_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); SIMCALL_SET_MC_VALUE(simcall, 0); simcall_HANDLER_comm_wait(simcall, comm, timeout); } -smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv, +smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_process_t receiver, smx_rdv_t rdv, void *dst_buff, size_t *dst_buff_size, int (*match_fun)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate) { - return SIMIX_comm_irecv(simcall->issuer, rdv, dst_buff, dst_buff_size, + return SIMIX_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index aa50f2a8cb..a61c0e592f 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -386,7 +386,7 @@ void smpi_mpi_start(MPI_Request request) request->real_size=request->size; smpi_datatype_use(request->old_type); smpi_comm_use(request->comm); - request->action = simcall_comm_irecv(mailbox, request->buf, + request->action = simcall_comm_irecv(SIMIX_process_self(), mailbox, request->buf, &request->real_size, &match_recv, !smpi_process_get_replaying()? &smpi_comm_copy_buffer_callback : &smpi_comm_null_copy_buffer_callback,