From: Martin Quinson Date: Thu, 21 Apr 2016 14:13:19 +0000 (+0200) Subject: Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid X-Git-Tag: v3_13~34^2~39 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/9e2f30eca15bf2c12a75bf0d59ee82f7c4553193?hp=3f3a7e2ce0689e0c9b003c7804d35f51e9dcfe14 Merge branch 'master' of scm.gforge.inria.fr:/gitroot/simgrid/simgrid --- diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 0ea4c0ef63..7642313895 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -26,7 +26,7 @@ SG_BEGIN_DECL() * #MSG_task_send and friends) hide this object behind a string * alias. That mean that you don't provide the mailbox on which you * want to send your task, but only the name of this mailbox. */ -typedef struct s_smx_rvpoint *msg_mailbox_t; +typedef struct s_smx_mailbox *msg_mailbox_t; /* ******************************** Environment ************************************ */ typedef simgrid_As *msg_as_t; diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index ae24e72b22..7c77c0bc44 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -136,9 +136,9 @@ typedef smx_process_t (*smx_creation_func_t) ( /******************************* Networking ***********************************/ /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management */ -typedef struct s_smx_rvpoint *smx_mailbox_t; +typedef struct s_smx_mailbox *smx_mailbox_t; XBT_PUBLIC(void*) SIMIX_comm_get_src_data(smx_synchro_t synchro); XBT_PUBLIC(void*) SIMIX_comm_get_dst_data(smx_synchro_t synchro); @@ -258,9 +258,9 @@ XBT_PUBLIC(void) SIMIX_comm_set_copy_data_callback(void (*callback) (smx_synchro XBT_PUBLIC(void) SIMIX_comm_copy_pointer_callback(smx_synchro_t comm, void* buff, size_t buff_size); XBT_PUBLIC(void) SIMIX_comm_copy_buffer_callback(smx_synchro_t comm, void* buff, size_t buff_size); -XBT_PUBLIC(smx_synchro_t) SIMIX_comm_get_send_match(smx_mailbox_t rdv, int (*match_fun)(void*, void*), void* data); -XBT_PUBLIC(int) SIMIX_comm_has_send_match(smx_mailbox_t rdv, int (*match_fun)(void*, void*), void* data); -XBT_PUBLIC(int) SIMIX_comm_has_recv_match(smx_mailbox_t rdv, int (*match_fun)(void*, void*), void* data); +XBT_PUBLIC(smx_synchro_t) SIMIX_comm_get_send_match(smx_mailbox_t mbox, int (*match_fun)(void*, void*), void* data); +XBT_PUBLIC(int) SIMIX_comm_has_send_match(smx_mailbox_t mbox, int (*match_fun)(void*, void*), void* data); +XBT_PUBLIC(int) SIMIX_comm_has_recv_match(smx_mailbox_t mbox, int (*match_fun)(void*, void*), void* data); XBT_PUBLIC(void) SIMIX_comm_finish(smx_synchro_t synchro); /******************************************************************************/ @@ -365,26 +365,26 @@ XBT_PUBLIC(e_smx_state_t) simcall_process_sleep(double duration); /************************** Comunication simcalls *****************************/ /***** Rendez-vous points *****/ -XBT_PUBLIC(smx_mailbox_t) simcall_rdv_create(const char *name); -XBT_PUBLIC(void) simcall_rdv_destroy(smx_mailbox_t rvp); -XBT_PUBLIC(smx_mailbox_t) simcall_rdv_get_by_name(const char *name); -XBT_PUBLIC(int) simcall_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host); -XBT_PUBLIC(smx_synchro_t) simcall_rdv_get_head(smx_mailbox_t rdv); -XBT_PUBLIC(smx_process_t) simcall_rdv_get_receiver(smx_mailbox_t rdv); -XBT_PUBLIC(void) simcall_rdv_set_receiver(smx_mailbox_t rdv , smx_process_t process); +XBT_PUBLIC(smx_mailbox_t) simcall_mbox_create(const char *name); +XBT_PUBLIC(void) simcall_mbox_destroy(smx_mailbox_t mbox); +XBT_PUBLIC(smx_mailbox_t) simcall_mbox_get_by_name(const char *name); +XBT_PUBLIC(int) simcall_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host); +XBT_PUBLIC(smx_synchro_t) simcall_mbox_get_head(smx_mailbox_t mbox); +XBT_PUBLIC(smx_process_t) simcall_mbox_get_receiver(smx_mailbox_t mbox); +XBT_PUBLIC(void) simcall_mbox_set_receiver(smx_mailbox_t mbox , smx_process_t process); -XBT_PUBLIC(xbt_dict_t) SIMIX_get_rdv_points(void); +XBT_PUBLIC(xbt_dict_t) SIMIX_get_mailboxes(void); /***** Communication simcalls *****/ -XBT_PUBLIC(void) simcall_comm_send(smx_process_t sender, smx_mailbox_t rdv, double task_size, +XBT_PUBLIC(void) simcall_comm_send(smx_process_t sender, smx_mailbox_t mbox, 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 sender, smx_mailbox_t rdv, +XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t sender, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, @@ -393,19 +393,19 @@ XBT_PUBLIC(smx_synchro_t) simcall_comm_isend(smx_process_t sender, smx_mailbox_t void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, int detached); -XBT_PUBLIC(void) simcall_comm_recv(smx_process_t receiver, smx_mailbox_t rdv, void *dst_buff, +XBT_PUBLIC(void) simcall_comm_recv(smx_process_t receiver, smx_mailbox_t mbox, 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_process_t receiver, smx_mailbox_t rdv, void *dst_buff, +XBT_PUBLIC(smx_synchro_t) simcall_comm_irecv(smx_process_t receiver, smx_mailbox_t mbox, 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_PUBLIC(smx_synchro_t) simcall_comm_iprobe(smx_mailbox_t rdv, int type, int src, int tag, +XBT_PUBLIC(smx_synchro_t) simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data); XBT_PUBLIC(void) simcall_comm_cancel(smx_synchro_t comm); diff --git a/src/bindings/java/jmsg_task.cpp b/src/bindings/java/jmsg_task.cpp index 5e83bf3a2b..d904fb3910 100644 --- a/src/bindings/java/jmsg_task.cpp +++ b/src/bindings/java/jmsg_task.cpp @@ -359,13 +359,10 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Task_sendBounded(JNIEnv * env,jobjec JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass cls, jstring jalias, jdouble jtimeout, jobject jhost) { - msg_error_t rv; - msg_task_t *task = xbt_new(msg_task_t,1); - *task = NULL; + msg_task_t task = NULL; msg_host_t host = NULL; jobject jtask_global, jtask_local; - const char *alias; if (jhost) { host = jhost_get_native(env, jhost); @@ -376,25 +373,23 @@ JNIEXPORT jobject JNICALL Java_org_simgrid_msg_Task_receive(JNIEnv * env, jclass } } - alias = env->GetStringUTFChars(jalias, 0); - rv = MSG_task_receive_ext(task, alias, (double) jtimeout, host); + const char *alias = env->GetStringUTFChars(jalias, 0); + msg_error_t rv = MSG_task_receive_ext(&task, alias, (double) jtimeout, host); if (env->ExceptionOccurred()) return NULL; if (rv != MSG_OK) { jmsg_throw_status(env,rv); return NULL; } - jtask_global = (jobject) MSG_task_get_data(*task); + jtask_global = (jobject) MSG_task_get_data(task); /* Convert the global ref into a local ref so that the JVM can free the stuff */ jtask_local = env->NewLocalRef(jtask_global); env->DeleteGlobalRef(jtask_global); - MSG_task_set_data(*task, NULL); + MSG_task_set_data(task, NULL); env->ReleaseStringUTFChars(jalias, alias); - xbt_free(task); - return (jobject) jtask_local; } diff --git a/src/mc/CommunicationDeterminismChecker.cpp b/src/mc/CommunicationDeterminismChecker.cpp index e183c7d07c..9a44b84feb 100644 --- a/src/mc/CommunicationDeterminismChecker.cpp +++ b/src/mc/CommunicationDeterminismChecker.cpp @@ -192,7 +192,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim (std::uint64_t) pattern->comm_addr); char* remote_name = mc_model_checker->process().read( - (std::uint64_t)(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name)); + (std::uint64_t)(synchro.comm.mbox ? &synchro.comm.mbox->name : &synchro.comm.mbox_cpy->name)); pattern->rdv = mc_model_checker->process().read_string(remote_name); pattern->src_proc = mc_model_checker->process().resolveProcess( simgrid::mc::remote(synchro.comm.src_proc))->pid; @@ -239,7 +239,7 @@ void CommunicationDeterminismChecker::get_comm_pattern(xbt_dynar_t list, smx_sim char* remote_name; mc_model_checker->process().read(&remote_name, - remote(synchro.comm.rdv ? &synchro.comm.rdv->name : &synchro.comm.rdv_cpy->name)); + remote(synchro.comm.mbox ? &synchro.comm.mbox->name : &synchro.comm.mbox_cpy->name)); pattern->rdv = mc_model_checker->process().read_string(remote_name); pattern->dst_proc = mc_model_checker->process().resolveProcess( simgrid::mc::remote(synchro.comm.dst_proc))->pid; @@ -607,4 +607,4 @@ Checker* createCommunicationDeterminismChecker(Session& session) } } -} \ No newline at end of file +} diff --git a/src/mc/mc_request.cpp b/src/mc/mc_request.cpp index fe69f83243..f3aaa70b2b 100644 --- a/src/mc/mc_request.cpp +++ b/src/mc/mc_request.cpp @@ -40,13 +40,13 @@ smx_synchro_t MC_get_comm(smx_simcall_t r) } static inline -smx_mailbox_t MC_get_rdv(smx_simcall_t r) +smx_mailbox_t MC_get_mbox(smx_simcall_t r) { switch(r->call) { case SIMCALL_COMM_ISEND: - return simcall_comm_isend__get__rdv(r); + return simcall_comm_isend__get__mbox(r); case SIMCALL_COMM_IRECV: - return simcall_comm_irecv__get__rdv(r); + return simcall_comm_irecv__get__mbox(r); default: return nullptr; } @@ -73,9 +73,9 @@ bool request_depend_asymmetric(smx_simcall_t r1, smx_simcall_t r2) if ((r1->call == SIMCALL_COMM_ISEND || r1->call == SIMCALL_COMM_IRECV) && r2->call == SIMCALL_COMM_WAIT) { - smx_mailbox_t rdv = MC_get_rdv(r1); + smx_mailbox_t mbox = MC_get_mbox(r1); - if (rdv != synchro2->comm.rdv_cpy + if (mbox != synchro2->comm.mbox_cpy && simcall_comm_wait__get__timeout(r2) <= 0) return false; @@ -159,9 +159,9 @@ bool request_depend(smx_simcall_t r1, smx_simcall_t r2) switch(r1->call) { case SIMCALL_COMM_ISEND: - return simcall_comm_isend__get__rdv(r1) == simcall_comm_isend__get__rdv(r2); + return simcall_comm_isend__get__mbox(r1) == simcall_comm_isend__get__mbox(r2); case SIMCALL_COMM_IRECV: - return simcall_comm_irecv__get__rdv(r1) == simcall_comm_irecv__get__rdv(r2); + return simcall_comm_irecv__get__mbox(r1) == simcall_comm_irecv__get__mbox(r2); case SIMCALL_COMM_WAIT: if (synchro1->comm.src_buff == synchro2->comm.src_buff && synchro1->comm.dst_buff == synchro2->comm.dst_buff) diff --git a/src/msg/msg_mailbox.cpp b/src/msg/msg_mailbox.cpp index cb67a3fdbf..5235ffbafb 100644 --- a/src/msg/msg_mailbox.cpp +++ b/src/msg/msg_mailbox.cpp @@ -13,22 +13,22 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_mailbox, msg, "Logging specific to MSG (mail msg_mailbox_t MSG_mailbox_new(const char *alias) { - return simcall_rdv_create(alias); + return simcall_mbox_create(alias); } void MSG_mailbox_free(void *mailbox) { - simcall_rdv_destroy((msg_mailbox_t)mailbox); + simcall_mbox_destroy((msg_mailbox_t)mailbox); } int MSG_mailbox_is_empty(msg_mailbox_t mailbox) { - return (NULL == simcall_rdv_get_head(mailbox)); + return (NULL == simcall_mbox_get_head(mailbox)); } msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox) { - smx_synchro_t comm = simcall_rdv_get_head(mailbox); + smx_synchro_t comm = simcall_mbox_get_head(mailbox); if (!comm) return NULL; @@ -38,12 +38,12 @@ msg_task_t MSG_mailbox_get_head(msg_mailbox_t mailbox) int MSG_mailbox_get_count_host_waiting_tasks(msg_mailbox_t mailbox, msg_host_t host) { - return simcall_rdv_comm_count_by_host(mailbox, host); + return simcall_mbox_comm_count_by_host(mailbox, host); } msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias) { - msg_mailbox_t mailbox = simcall_rdv_get_by_name(alias); + msg_mailbox_t mailbox = simcall_mbox_get_by_name(alias); if (!mailbox) mailbox = MSG_mailbox_new(alias); @@ -63,7 +63,7 @@ msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias) void MSG_mailbox_set_async(const char *alias){ msg_mailbox_t mailbox = MSG_mailbox_get_by_alias(alias); - simcall_rdv_set_receiver(mailbox, SIMIX_process_self()); + simcall_mbox_set_receiver(mailbox, SIMIX_process_self()); XBT_VERB("%s mailbox set to receive eagerly for process %p\n",alias, SIMIX_process_self()); } diff --git a/src/s4u/s4u_mailbox.cpp b/src/s4u/s4u_mailbox.cpp index e393748c75..b2afd59b4a 100644 --- a/src/s4u/s4u_mailbox.cpp +++ b/src/s4u/s4u_mailbox.cpp @@ -32,10 +32,10 @@ s4u::Mailbox *s4u::Mailbox::byName(const char*name) { res = mailboxes->at(name); } catch (std::out_of_range& e) { // FIXME: there is a potential race condition here where two actors run Mailbox::byName on a non-existent mailbox - // during the same scheduling round. Both will be interrupted in the simcall creating the underlying simix rdv. + // during the same scheduling round. Both will be interrupted in the simcall creating the underlying simix mbox. // Only one simix object will be created, but two S4U objects will be created. // Only one S4U object will be stored in the hashmap and used, and the other one will be leaked. - new Mailbox(name,simcall_rdv_create(name)); + new Mailbox(name,simcall_mbox_create(name)); res = mailboxes->at(name); // Use the stored one, even if it's not the one I created myself. } return res; diff --git a/src/simix/libsmx.cpp b/src/simix/libsmx.cpp index 278ce88e7c..4406c4ef27 100644 --- a/src/simix/libsmx.cpp +++ b/src/simix/libsmx.cpp @@ -728,79 +728,77 @@ e_smx_state_t simcall_process_sleep(double duration) } /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management * \brief Creates a new rendez-vous point * \param name The name of the rendez-vous point * \return The created rendez-vous point */ -smx_mailbox_t simcall_rdv_create(const char *name) +smx_mailbox_t simcall_mbox_create(const char *name) { - return simcall_BODY_rdv_create(name); + return simcall_BODY_mbox_create(name); } /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management * \brief Destroy a rendez-vous point - * \param rdv The rendez-vous point to destroy + * \param mbox The rendez-vous point to destroy */ -void simcall_rdv_destroy(smx_mailbox_t rdv) +void simcall_mbox_destroy(smx_mailbox_t mbox) { - simcall_BODY_rdv_destroy(rdv); + simcall_BODY_mbox_destroy(mbox); } /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management * \brief Returns a rendez-vous point knowing its name */ -smx_mailbox_t simcall_rdv_get_by_name(const char *name) +smx_mailbox_t simcall_mbox_get_by_name(const char *name) { - xbt_assert(name != NULL, "Invalid parameter for simcall_rdv_get_by_name (name is NULL)"); - /* FIXME: this is a horrible loss of performance, so we hack it out by * skipping the simcall (for now). It works in parallel, it won't work on * distributed but probably we will change MSG for that. */ - return SIMIX_rdv_get_by_name(name); + return SIMIX_mbox_get_by_name(name); } /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management * \brief Counts the number of communication synchros of a given host pending * on a rendez-vous point. - * \param rdv The rendez-vous point + * \param mbox The rendez-vous point * \param host The host to be counted - * \return The number of comm synchros pending in the rdv + * \return The number of comm synchros pending in the mbox */ -int simcall_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host) +int simcall_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host) { - return simcall_BODY_rdv_comm_count_by_host(rdv, host); + return simcall_BODY_mbox_comm_count_by_host(mbox, host); } /** - * \ingroup simix_rdv_management + * \ingroup simix_mbox_management * \brief returns the communication at the head of the rendez-vous - * \param rdv The rendez-vous point + * \param mbox The rendez-vous point * \return The communication or NULL if empty */ -smx_synchro_t simcall_rdv_get_head(smx_mailbox_t rdv) +smx_synchro_t simcall_mbox_get_head(smx_mailbox_t mbox) { - return simcall_BODY_rdv_get_head(rdv); + return simcall_BODY_mbox_get_head(mbox); } -void simcall_rdv_set_receiver(smx_mailbox_t rdv, smx_process_t process) +void simcall_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t process) { - simcall_BODY_rdv_set_receiver(rdv, process); + simcall_BODY_mbox_set_receiver(mbox, process); } -smx_process_t simcall_rdv_get_receiver(smx_mailbox_t rdv) +smx_process_t simcall_mbox_get_receiver(smx_mailbox_t mbox) { - return simcall_BODY_rdv_get_receiver(rdv); + return simcall_BODY_mbox_get_receiver(mbox); } /** * \ingroup simix_comm_management */ -void simcall_comm_send(smx_process_t sender, smx_mailbox_t rdv, double task_size, double rate, +void simcall_comm_send(smx_process_t sender, smx_mailbox_t mbox, 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, @@ -811,18 +809,18 @@ void simcall_comm_send(smx_process_t sender, smx_mailbox_t rdv, double task_size xbt_assert(std::isfinite(rate), "rate is not finite!"); xbt_assert(std::isfinite(timeout), "timeout is not finite!"); - xbt_assert(rdv, "No rendez-vous point defined for send"); + xbt_assert(mbox, "No rendez-vous point defined for send"); 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(sender, rdv, task_size, rate, + comm = simcall_comm_isend(sender, mbox, 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(sender, rdv, task_size, rate, src_buff, src_buff_size, + simcall_BODY_comm_send(sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, copy_data_fun, data, timeout); } } @@ -830,7 +828,7 @@ void simcall_comm_send(smx_process_t sender, smx_mailbox_t rdv, double task_size /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_mailbox_t rdv, double task_size, double rate, +smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_mailbox_t mbox, 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 *), @@ -842,9 +840,9 @@ smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_mailbox_t rdv, double xbt_assert(std::isfinite(task_size), "task_size is not finite!"); xbt_assert(std::isfinite(rate), "rate is not finite!"); - xbt_assert(rdv, "No rendez-vous point defined for isend"); + xbt_assert(mbox, "No rendez-vous point defined for isend"); - return simcall_BODY_comm_isend(sender, rdv, task_size, rate, src_buff, + return simcall_BODY_comm_isend(sender, mbox, task_size, rate, src_buff, src_buff_size, match_fun, clean_fun, copy_data_fun, data, detached); } @@ -852,50 +850,50 @@ smx_synchro_t simcall_comm_isend(smx_process_t sender, smx_mailbox_t rdv, double /** * \ingroup simix_comm_management */ -void simcall_comm_recv(smx_process_t receiver, smx_mailbox_t rdv, void *dst_buff, size_t * dst_buff_size, +void simcall_comm_recv(smx_process_t receiver, smx_mailbox_t mbox, 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_assert(std::isfinite(timeout), "timeout is not finite!"); - xbt_assert(rdv, "No rendez-vous point defined for recv"); + xbt_assert(mbox, "No rendez-vous point defined for recv"); 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(receiver, rdv, dst_buff, dst_buff_size, + comm = simcall_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); simcall_comm_wait(comm, timeout); comm = NULL; } else { - simcall_BODY_comm_recv(receiver, rdv, dst_buff, dst_buff_size, + simcall_BODY_comm_recv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); } } /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_irecv(smx_process_t receiver, smx_mailbox_t rdv, void *dst_buff, size_t *dst_buff_size, +smx_synchro_t simcall_comm_irecv(smx_process_t receiver, smx_mailbox_t mbox, 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"); + xbt_assert(mbox, "No rendez-vous point defined for irecv"); - return simcall_BODY_comm_irecv(receiver, rdv, dst_buff, dst_buff_size, + return simcall_BODY_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } /** * \ingroup simix_comm_management */ -smx_synchro_t simcall_comm_iprobe(smx_mailbox_t rdv, int type, int src, int tag, +smx_synchro_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data) { - xbt_assert(rdv, "No rendez-vous point defined for iprobe"); + xbt_assert(mbox, "No rendez-vous point defined for iprobe"); - return simcall_BODY_comm_iprobe(rdv, type, src, tag, match_fun, data); + return simcall_BODY_comm_iprobe(mbox, type, src, tag, match_fun, data); } /** diff --git a/src/simix/popping_accessors.h b/src/simix/popping_accessors.h index b7aa14364b..63b0c030dd 100644 --- a/src/simix/popping_accessors.h +++ b/src/simix/popping_accessors.h @@ -432,88 +432,88 @@ static inline void simcall_process_restart__set__result(smx_simcall_t simcall, v simcall->result.dp = result; } -static inline const char* simcall_rdv_create__get__name(smx_simcall_t simcall) { +static inline const char* simcall_mbox_create__get__name(smx_simcall_t simcall) { return simcall->args[0].cc; } -static inline void simcall_rdv_create__set__name(smx_simcall_t simcall, const char* arg) { +static inline void simcall_mbox_create__set__name(smx_simcall_t simcall, const char* arg) { simcall->args[0].cc = arg; } -static inline smx_mailbox_t simcall_rdv_create__get__result(smx_simcall_t simcall){ +static inline smx_mailbox_t simcall_mbox_create__get__result(smx_simcall_t simcall){ return (smx_mailbox_t) simcall->result.dp; } -static inline void simcall_rdv_create__set__result(smx_simcall_t simcall, void* result){ +static inline void simcall_mbox_create__set__result(smx_simcall_t simcall, void* result){ simcall->result.dp = result; } -static inline smx_mailbox_t simcall_rdv_destroy__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_mbox_destroy__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_rdv_destroy__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_destroy__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mailbox_t simcall_rdv_comm_count_by_host__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_mbox_comm_count_by_host__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_rdv_comm_count_by_host__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_comm_count_by_host__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline sg_host_t simcall_rdv_comm_count_by_host__get__host(smx_simcall_t simcall) { +static inline sg_host_t simcall_mbox_comm_count_by_host__get__host(smx_simcall_t simcall) { return (sg_host_t) simcall->args[1].dp; } -static inline void simcall_rdv_comm_count_by_host__set__host(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_comm_count_by_host__set__host(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline unsigned int simcall_rdv_comm_count_by_host__get__result(smx_simcall_t simcall){ +static inline unsigned int simcall_mbox_comm_count_by_host__get__result(smx_simcall_t simcall){ return simcall->result.ui; } -static inline void simcall_rdv_comm_count_by_host__set__result(smx_simcall_t simcall, unsigned int result){ +static inline void simcall_mbox_comm_count_by_host__set__result(smx_simcall_t simcall, unsigned int result){ simcall->result.ui = result; } -static inline smx_mailbox_t simcall_rdv_get_head__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_mbox_get_head__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_rdv_get_head__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_get_head__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_synchro_t simcall_rdv_get_head__get__result(smx_simcall_t simcall){ +static inline smx_synchro_t simcall_mbox_get_head__get__result(smx_simcall_t simcall){ return (smx_synchro_t) simcall->result.dp; } -static inline void simcall_rdv_get_head__set__result(smx_simcall_t simcall, void* result){ +static inline void simcall_mbox_get_head__set__result(smx_simcall_t simcall, void* result){ simcall->result.dp = result; } -static inline smx_mailbox_t simcall_rdv_set_receiver__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_mbox_set_receiver__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_rdv_set_receiver__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_set_receiver__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_rdv_set_receiver__get__receiver(smx_simcall_t simcall) { +static inline smx_process_t simcall_mbox_set_receiver__get__receiver(smx_simcall_t simcall) { return (smx_process_t) simcall->args[1].dp; } -static inline void simcall_rdv_set_receiver__set__receiver(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_set_receiver__set__receiver(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } -static inline smx_mailbox_t simcall_rdv_get_receiver__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_mbox_get_receiver__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_rdv_get_receiver__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_mbox_get_receiver__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_process_t simcall_rdv_get_receiver__get__result(smx_simcall_t simcall){ +static inline smx_process_t simcall_mbox_get_receiver__get__result(smx_simcall_t simcall){ return (smx_process_t) simcall->result.dp; } -static inline void simcall_rdv_get_receiver__set__result(smx_simcall_t simcall, void* result){ +static inline void simcall_mbox_get_receiver__set__result(smx_simcall_t simcall, void* result){ simcall->result.dp = result; } -static inline smx_mailbox_t simcall_comm_iprobe__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_comm_iprobe__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[0].dp; } -static inline void simcall_comm_iprobe__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_iprobe__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } static inline int simcall_comm_iprobe__get__type(smx_simcall_t simcall) { @@ -559,10 +559,10 @@ static inline smx_process_t simcall_comm_send__get__sender(smx_simcall_t simcall static inline void simcall_comm_send__set__sender(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mailbox_t simcall_comm_send__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_comm_send__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[1].dp; } -static inline void simcall_comm_send__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_send__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } static inline double simcall_comm_send__get__task_size(smx_simcall_t simcall) { @@ -620,10 +620,10 @@ static inline smx_process_t simcall_comm_isend__get__sender(smx_simcall_t simcal static inline void simcall_comm_isend__set__sender(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mailbox_t simcall_comm_isend__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_comm_isend__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[1].dp; } -static inline void simcall_comm_isend__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_isend__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } static inline double simcall_comm_isend__get__task_size(smx_simcall_t simcall) { @@ -693,10 +693,10 @@ static inline smx_process_t simcall_comm_recv__get__receiver(smx_simcall_t simca static inline void simcall_comm_recv__set__receiver(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mailbox_t simcall_comm_recv__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_comm_recv__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[1].dp; } -static inline void simcall_comm_recv__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_recv__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } static inline void* simcall_comm_recv__get__dst_buff(smx_simcall_t simcall) { @@ -748,10 +748,10 @@ static inline smx_process_t simcall_comm_irecv__get__receiver(smx_simcall_t simc static inline void simcall_comm_irecv__set__receiver(smx_simcall_t simcall, void* arg) { simcall->args[0].dp = arg; } -static inline smx_mailbox_t simcall_comm_irecv__get__rdv(smx_simcall_t simcall) { +static inline smx_mailbox_t simcall_comm_irecv__get__mbox(smx_simcall_t simcall) { return (smx_mailbox_t) simcall->args[1].dp; } -static inline void simcall_comm_irecv__set__rdv(smx_simcall_t simcall, void* arg) { +static inline void simcall_comm_irecv__set__mbox(smx_simcall_t simcall, void* arg) { simcall->args[1].dp = arg; } static inline void* simcall_comm_irecv__get__dst_buff(smx_simcall_t simcall) { @@ -1399,11 +1399,11 @@ XBT_PRIVATE void simcall_HANDLER_process_sleep(smx_simcall_t simcall, double dur XBT_PRIVATE smx_synchro_t simcall_HANDLER_execution_start(smx_simcall_t simcall, const char* name, double flops_amount, double priority, double bound, unsigned long affinity_mask); XBT_PRIVATE void simcall_HANDLER_execution_wait(smx_simcall_t simcall, smx_synchro_t execution); XBT_PRIVATE smx_process_t simcall_HANDLER_process_restart(smx_simcall_t simcall, smx_process_t process); -XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data); -XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t sender, smx_mailbox_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); -XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sender, smx_mailbox_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); -XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_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); -XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_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); +XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data); +XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t sender, smx_mailbox_t mbox, 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); +XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sender, smx_mailbox_t mbox, 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); +XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, 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); +XBT_PRIVATE smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, 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); XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, xbt_dynar_t comms); XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, smx_synchro_t comm, double timeout); XBT_PRIVATE void simcall_HANDLER_comm_test(smx_simcall_t simcall, smx_synchro_t comm); diff --git a/src/simix/popping_bodies.cpp b/src/simix/popping_bodies.cpp index f5035a21de..88ff816791 100644 --- a/src/simix/popping_bodies.cpp +++ b/src/simix/popping_bodies.cpp @@ -633,14 +633,14 @@ inline static smx_process_t simcall_BODY_process_restart(smx_process_t process) return (smx_process_t) self->simcall.result.dp; } -inline static smx_mailbox_t simcall_BODY_rdv_create(const char* name) { +inline static smx_mailbox_t simcall_BODY_mbox_create(const char* name) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_create(name); + if (0) SIMIX_mbox_create(name); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_CREATE; + self->simcall.call = SIMCALL_MBOX_CREATE; memset(&self->simcall.result, 0, sizeof(self->simcall.result)); memset(self->simcall.args, 0, sizeof(self->simcall.args)); self->simcall.args[0].cc = (const char*) name; @@ -654,17 +654,17 @@ inline static smx_mailbox_t simcall_BODY_rdv_create(const char* name) { return (smx_mailbox_t) self->simcall.result.dp; } -inline static void simcall_BODY_rdv_destroy(smx_mailbox_t rdv) { +inline static void simcall_BODY_mbox_destroy(smx_mailbox_t mbox) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_destroy(rdv); + if (0) SIMIX_mbox_destroy(mbox); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_DESTROY; + self->simcall.call = SIMCALL_MBOX_DESTROY; 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[0].dp = (void*) mbox; 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); @@ -675,17 +675,17 @@ inline static void simcall_BODY_rdv_destroy(smx_mailbox_t rdv) { } -inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host) { +inline static unsigned int simcall_BODY_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_comm_count_by_host(rdv, host); + if (0) SIMIX_mbox_comm_count_by_host(mbox, host); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_COMM_COUNT_BY_HOST; + self->simcall.call = SIMCALL_MBOX_COMM_COUNT_BY_HOST; 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[0].dp = (void*) mbox; self->simcall.args[1].dp = (void*) host; if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, @@ -697,17 +697,17 @@ inline static unsigned int simcall_BODY_rdv_comm_count_by_host(smx_mailbox_t rdv return (unsigned int) self->simcall.result.ui; } -inline static smx_synchro_t simcall_BODY_rdv_get_head(smx_mailbox_t rdv) { +inline static smx_synchro_t simcall_BODY_mbox_get_head(smx_mailbox_t mbox) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_get_head(rdv); + if (0) SIMIX_mbox_get_head(mbox); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_GET_HEAD; + self->simcall.call = SIMCALL_MBOX_GET_HEAD; 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[0].dp = (void*) mbox; 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); @@ -718,17 +718,17 @@ inline static smx_synchro_t simcall_BODY_rdv_get_head(smx_mailbox_t rdv) { return (smx_synchro_t) self->simcall.result.dp; } -inline static void simcall_BODY_rdv_set_receiver(smx_mailbox_t rdv, smx_process_t receiver) { +inline static void simcall_BODY_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t receiver) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_set_receiver(rdv, receiver); + if (0) SIMIX_mbox_set_receiver(mbox, receiver); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_SET_RECEIVER; + self->simcall.call = SIMCALL_MBOX_SET_RECEIVER; 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[0].dp = (void*) mbox; self->simcall.args[1].dp = (void*) receiver; if (self != simix_global->maestro_process) { XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name, @@ -740,17 +740,17 @@ inline static void simcall_BODY_rdv_set_receiver(smx_mailbox_t rdv, smx_process_ } -inline static smx_process_t simcall_BODY_rdv_get_receiver(smx_mailbox_t rdv) { +inline static smx_process_t simcall_BODY_mbox_get_receiver(smx_mailbox_t mbox) { smx_process_t self = SIMIX_process_self(); /* Go to that function to follow the code flow through the simcall barrier */ - if (0) SIMIX_rdv_get_receiver(rdv); + if (0) SIMIX_mbox_get_receiver(mbox); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ - self->simcall.call = SIMCALL_RDV_GET_RECEIVER; + self->simcall.call = SIMCALL_MBOX_GET_RECEIVER; 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[0].dp = (void*) mbox; 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); @@ -761,17 +761,17 @@ inline static smx_process_t simcall_BODY_rdv_get_receiver(smx_mailbox_t rdv) { return (smx_process_t) self->simcall.result.dp; } -inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_mailbox_t rdv, int type, int src, int tag, simix_match_func_t match_fun, void* data) { +inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag, simix_match_func_t match_fun, void* data) { 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_iprobe(&self->simcall, rdv, type, src, tag, match_fun, data); + if (0) simcall_HANDLER_comm_iprobe(&self->simcall, mbox, type, src, tag, match_fun, data); /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */ 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[0].dp = (void*) mbox; self->simcall.args[1].i = (int) type; self->simcall.args[2].i = (int) src; self->simcall.args[3].i = (int) tag; @@ -787,18 +787,18 @@ inline static smx_synchro_t simcall_BODY_comm_iprobe(smx_mailbox_t rdv, int type return (smx_synchro_t) self->simcall.result.dp; } -inline static void simcall_BODY_comm_send(smx_process_t sender, smx_mailbox_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_mailbox_t mbox, 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, sender, 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, mbox, 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*) sender; - self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[1].dp = (void*) mbox; self->simcall.args[2].d = (double) task_size; self->simcall.args[3].d = (double) rate; self->simcall.args[4].dp = (void*) src_buff; @@ -817,18 +817,18 @@ inline static void simcall_BODY_comm_send(smx_process_t sender, smx_mailbox_t rd } -inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t sender, smx_mailbox_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_mailbox_t mbox, 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, sender, 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, mbox, 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*) sender; - self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[1].dp = (void*) mbox; self->simcall.args[2].d = (double) task_size; self->simcall.args[3].d = (double) rate; self->simcall.args[4].dp = (void*) src_buff; @@ -848,18 +848,18 @@ inline static smx_synchro_t simcall_BODY_comm_isend(smx_process_t sender, smx_ma return (smx_synchro_t) self->simcall.result.dp; } -inline static void simcall_BODY_comm_recv(smx_process_t receiver, smx_mailbox_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_mailbox_t mbox, 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, receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, timeout, rate); + if (0) simcall_HANDLER_comm_recv(&self->simcall, receiver, mbox, 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*) receiver; - self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[1].dp = (void*) mbox; 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; @@ -877,18 +877,18 @@ inline static void simcall_BODY_comm_recv(smx_process_t receiver, smx_mailbox_t } -inline static smx_synchro_t simcall_BODY_comm_irecv(smx_process_t receiver, smx_mailbox_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_mailbox_t mbox, 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, receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); + if (0) simcall_HANDLER_comm_irecv(&self->simcall, receiver, mbox, 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*) receiver; - self->simcall.args[1].dp = (void*) rdv; + self->simcall.args[1].dp = (void*) mbox; 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; diff --git a/src/simix/popping_enum.h b/src/simix/popping_enum.h index 877f0a3a11..8dca2b7bb2 100644 --- a/src/simix/popping_enum.h +++ b/src/simix/popping_enum.h @@ -46,12 +46,12 @@ typedef enum { SIMCALL_PROCESS_ON_EXIT, SIMCALL_PROCESS_AUTO_RESTART_SET, SIMCALL_PROCESS_RESTART, - SIMCALL_RDV_CREATE, - SIMCALL_RDV_DESTROY, - SIMCALL_RDV_COMM_COUNT_BY_HOST, - SIMCALL_RDV_GET_HEAD, - SIMCALL_RDV_SET_RECEIVER, - SIMCALL_RDV_GET_RECEIVER, + SIMCALL_MBOX_CREATE, + SIMCALL_MBOX_DESTROY, + SIMCALL_MBOX_COMM_COUNT_BY_HOST, + SIMCALL_MBOX_GET_HEAD, + SIMCALL_MBOX_SET_RECEIVER, + SIMCALL_MBOX_GET_RECEIVER, SIMCALL_COMM_IPROBE, SIMCALL_COMM_SEND, SIMCALL_COMM_ISEND, diff --git a/src/simix/popping_generated.cpp b/src/simix/popping_generated.cpp index d7a8dc8a11..0e5b55a328 100644 --- a/src/simix/popping_generated.cpp +++ b/src/simix/popping_generated.cpp @@ -51,12 +51,12 @@ const char* simcall_names[] = { "SIMCALL_PROCESS_ON_EXIT", "SIMCALL_PROCESS_AUTO_RESTART_SET", "SIMCALL_PROCESS_RESTART", - "SIMCALL_RDV_CREATE", - "SIMCALL_RDV_DESTROY", - "SIMCALL_RDV_COMM_COUNT_BY_HOST", - "SIMCALL_RDV_GET_HEAD", - "SIMCALL_RDV_SET_RECEIVER", - "SIMCALL_RDV_GET_RECEIVER", + "SIMCALL_MBOX_CREATE", + "SIMCALL_MBOX_DESTROY", + "SIMCALL_MBOX_COMM_COUNT_BY_HOST", + "SIMCALL_MBOX_GET_HEAD", + "SIMCALL_MBOX_SET_RECEIVER", + "SIMCALL_MBOX_GET_RECEIVER", "SIMCALL_COMM_IPROBE", "SIMCALL_COMM_SEND", "SIMCALL_COMM_ISEND", @@ -254,33 +254,33 @@ case SIMCALL_PROCESS_RESTART: SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_CREATE: - simcall->result.dp = SIMIX_rdv_create( simcall->args[0].cc); +case SIMCALL_MBOX_CREATE: + simcall->result.dp = SIMIX_mbox_create( simcall->args[0].cc); SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_DESTROY: - SIMIX_rdv_destroy((smx_mailbox_t) simcall->args[0].dp); +case SIMCALL_MBOX_DESTROY: + SIMIX_mbox_destroy((smx_mailbox_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_COMM_COUNT_BY_HOST: - simcall->result.ui = SIMIX_rdv_comm_count_by_host((smx_mailbox_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp); +case SIMCALL_MBOX_COMM_COUNT_BY_HOST: + simcall->result.ui = SIMIX_mbox_comm_count_by_host((smx_mailbox_t) simcall->args[0].dp,(sg_host_t) simcall->args[1].dp); SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_GET_HEAD: - simcall->result.dp = SIMIX_rdv_get_head((smx_mailbox_t) simcall->args[0].dp); +case SIMCALL_MBOX_GET_HEAD: + simcall->result.dp = SIMIX_mbox_get_head((smx_mailbox_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_SET_RECEIVER: - SIMIX_rdv_set_receiver((smx_mailbox_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp); +case SIMCALL_MBOX_SET_RECEIVER: + SIMIX_mbox_set_receiver((smx_mailbox_t) simcall->args[0].dp,(smx_process_t) simcall->args[1].dp); SIMIX_simcall_answer(simcall); break; -case SIMCALL_RDV_GET_RECEIVER: - simcall->result.dp = SIMIX_rdv_get_receiver((smx_mailbox_t) simcall->args[0].dp); +case SIMCALL_MBOX_GET_RECEIVER: + simcall->result.dp = SIMIX_mbox_get_receiver((smx_mailbox_t) simcall->args[0].dp); SIMIX_simcall_answer(simcall); break; diff --git a/src/simix/simcalls.in b/src/simix/simcalls.in index 904718dcc9..07cc8628b3 100644 --- a/src/simix/simcalls.in +++ b/src/simix/simcalls.in @@ -78,18 +78,18 @@ Proc - process_on_exit (void) (process, void*, smx_process_t) (fun, FPtr, int_f_ Proc - process_auto_restart_set (void) (process, void*, smx_process_t) (auto_restart, int) Func H process_restart (void*, smx_process_t) (process, void*, smx_process_t) -Func - rdv_create (void*, smx_mailbox_t) (name, const char*) -Proc - rdv_destroy (void) (rdv, void*, smx_mailbox_t) -Func - rdv_comm_count_by_host (unsigned int) (rdv, void*, smx_mailbox_t) (host, void*, sg_host_t) -Func - rdv_get_head (void*, smx_synchro_t) (rdv, void*, smx_mailbox_t) -Proc - rdv_set_receiver (void) (rdv, void*, smx_mailbox_t) (receiver, void*, smx_process_t) -Func - rdv_get_receiver (void*, smx_process_t) (rdv, void*, smx_mailbox_t) - -Func H comm_iprobe (void*, smx_synchro_t) (rdv, void*, smx_mailbox_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*) -Blck H comm_send (void) (sender, void*, smx_process_t) (rdv, void*, smx_mailbox_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_mailbox_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_mailbox_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_mailbox_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) +Func - mbox_create (void*, smx_mailbox_t) (name, const char*) +Proc - mbox_destroy (void) (mbox, void*, smx_mailbox_t) +Func - mbox_comm_count_by_host (unsigned int) (mbox, void*, smx_mailbox_t) (host, void*, sg_host_t) +Func - mbox_get_head (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t) +Proc - mbox_set_receiver (void) (mbox, void*, smx_mailbox_t) (receiver, void*, smx_process_t) +Func - mbox_get_receiver (void*, smx_process_t) (mbox, void*, smx_mailbox_t) + +Func H comm_iprobe (void*, smx_synchro_t) (mbox, void*, smx_mailbox_t) (type, int) (src, int) (tag, int) (match_fun, FPtr, simix_match_func_t) (data, void*) +Blck H comm_send (void) (sender, void*, smx_process_t) (mbox, void*, smx_mailbox_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) (mbox, void*, smx_mailbox_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) (mbox, void*, smx_mailbox_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) (mbox, void*, smx_mailbox_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.cpp b/src/simix/smx_network.cpp index 9b79a4f915..b3d4c065c9 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -13,90 +13,90 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization"); -static xbt_dict_t rdv_points = NULL; +static xbt_dict_t mailboxes = NULL; XBT_EXPORT_NO_IMPORT(unsigned long int) smx_total_comms = 0; static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall); static void SIMIX_comm_copy_data(smx_synchro_t comm); static smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type); -static inline void SIMIX_rdv_push(smx_mailbox_t rdv, smx_synchro_t comm); +static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_synchro_t comm); static smx_synchro_t SIMIX_fifo_probe_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, int (*match_fun)(void *, void *,smx_synchro_t), void *user_data, smx_synchro_t my_synchro); static smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, int (*match_fun)(void *, void *,smx_synchro_t), void *user_data, smx_synchro_t my_synchro); -static void SIMIX_rdv_free(void *data); +static void SIMIX_mbox_free(void *data); static void SIMIX_comm_start(smx_synchro_t synchro); void SIMIX_network_init(void) { - rdv_points = xbt_dict_new_homogeneous(SIMIX_rdv_free); + mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free); } void SIMIX_network_exit(void) { - xbt_dict_free(&rdv_points); + xbt_dict_free(&mailboxes); } /******************************************************************************/ /* Rendez-Vous Points */ /******************************************************************************/ -smx_mailbox_t SIMIX_rdv_create(const char *name) +smx_mailbox_t SIMIX_mbox_create(const char *name) { - /* two processes may have pushed the same rdv_create simcall at the same time */ - smx_mailbox_t rdv = name ? (smx_mailbox_t) xbt_dict_get_or_null(rdv_points, name) : NULL; + /* two processes may have pushed the same mbox_create simcall at the same time */ + smx_mailbox_t mbox = name ? (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name) : NULL; - if (!rdv) { - rdv = xbt_new0(s_smx_rvpoint_t, 1); - rdv->name = name ? xbt_strdup(name) : NULL; - rdv->comm_fifo = xbt_fifo_new(); - rdv->done_comm_fifo = xbt_fifo_new(); - rdv->permanent_receiver=NULL; + if (!mbox) { + mbox = xbt_new0(s_smx_mailbox_t, 1); + mbox->name = name ? xbt_strdup(name) : NULL; + mbox->comm_fifo = xbt_fifo_new(); + mbox->done_comm_fifo = xbt_fifo_new(); + mbox->permanent_receiver=NULL; - XBT_DEBUG("Creating a mailbox at %p with name %s", rdv, name); + XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name); - if (rdv->name) - xbt_dict_set(rdv_points, rdv->name, rdv, NULL); + if (mbox->name) + xbt_dict_set(mailboxes, mbox->name, mbox, NULL); } - return rdv; + return mbox; } -void SIMIX_rdv_destroy(smx_mailbox_t rdv) +void SIMIX_mbox_destroy(smx_mailbox_t mbox) { - if (rdv->name) - xbt_dict_remove(rdv_points, rdv->name); + if (mbox->name) + xbt_dict_remove(mailboxes, mbox->name); } -void SIMIX_rdv_free(void *data) +void SIMIX_mbox_free(void *data) { - XBT_DEBUG("rdv free %p", data); - smx_mailbox_t rdv = (smx_mailbox_t) data; - xbt_free(rdv->name); - xbt_fifo_free(rdv->comm_fifo); - xbt_fifo_free(rdv->done_comm_fifo); + XBT_DEBUG("mbox free %p", data); + smx_mailbox_t mbox = (smx_mailbox_t) data; + xbt_free(mbox->name); + xbt_fifo_free(mbox->comm_fifo); + xbt_fifo_free(mbox->done_comm_fifo); - xbt_free(rdv); + xbt_free(mbox); } -xbt_dict_t SIMIX_get_rdv_points() +xbt_dict_t SIMIX_get_mailboxes() { - return rdv_points; + return mailboxes; } -smx_mailbox_t SIMIX_rdv_get_by_name(const char *name) +smx_mailbox_t SIMIX_mbox_get_by_name(const char *name) { - return (smx_mailbox_t) xbt_dict_get_or_null(rdv_points, name); + return (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name); } -int SIMIX_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host) +int SIMIX_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host) { smx_synchro_t comm = NULL; xbt_fifo_item_t item = NULL; int count = 0; - xbt_fifo_foreach(rdv->comm_fifo, item, comm, smx_synchro_t) { + xbt_fifo_foreach(mbox->comm_fifo, item, comm, smx_synchro_t) { if (comm->comm.src_proc->host == host) count++; } @@ -104,52 +104,52 @@ int SIMIX_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host) return count; } -smx_synchro_t SIMIX_rdv_get_head(smx_mailbox_t rdv) +smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox) { return (smx_synchro_t) xbt_fifo_get_item_content( - xbt_fifo_get_first_item(rdv->comm_fifo)); + xbt_fifo_get_first_item(mbox->comm_fifo)); } /** * \brief get the receiver (process associated to the mailbox) - * \param rdv The rendez-vous point + * \param mbox The rendez-vous point * \return process The receiving process (NULL if not set) */ -smx_process_t SIMIX_rdv_get_receiver(smx_mailbox_t rdv) +smx_process_t SIMIX_mbox_get_receiver(smx_mailbox_t mbox) { - return rdv->permanent_receiver; + return mbox->permanent_receiver; } /** * \brief set the receiver of the rendez vous point to allow eager sends - * \param rdv The rendez-vous point + * \param mbox The rendez-vous point * \param process The receiving process */ -void SIMIX_rdv_set_receiver(smx_mailbox_t rdv, smx_process_t process) +void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t process) { - rdv->permanent_receiver=process; + mbox->permanent_receiver=process; } /** * \brief Pushes a communication synchro into a rendez-vous point - * \param rdv The rendez-vous point + * \param mbox The mailbox * \param comm The communication synchro */ -static inline void SIMIX_rdv_push(smx_mailbox_t rdv, smx_synchro_t comm) +static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_synchro_t comm) { - xbt_fifo_push(rdv->comm_fifo, comm); - comm->comm.rdv = rdv; + xbt_fifo_push(mbox->comm_fifo, comm); + comm->comm.mbox = mbox; } /** * \brief Removes a communication synchro from a rendez-vous point - * \param rdv The rendez-vous point + * \param mbox The rendez-vous point * \param comm The communication synchro */ -void SIMIX_rdv_remove(smx_mailbox_t rdv, smx_synchro_t comm) +void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t comm) { - xbt_fifo_remove(rdv->comm_fifo, comm); - comm->comm.rdv = NULL; + xbt_fifo_remove(mbox->comm_fifo, comm); + comm->comm.mbox = NULL; } /** @@ -179,9 +179,9 @@ smx_synchro_t SIMIX_fifo_get_comm(xbt_fifo_t fifo, e_smx_comm_type_t type, xbt_fifo_free_item(item); synchro->comm.refcount++; #if HAVE_MC - synchro->comm.rdv_cpy = synchro->comm.rdv; + synchro->comm.mbox_cpy = synchro->comm.mbox; #endif - synchro->comm.rdv = NULL; + synchro->comm.mbox = NULL; return synchro; } XBT_DEBUG("Sorry, communication synchro %p does not match our needs:" @@ -292,8 +292,8 @@ void SIMIX_comm_destroy(smx_synchro_t synchro) synchro->comm.src_buff = NULL; } - if(synchro->comm.rdv) - SIMIX_rdv_remove(synchro->comm.rdv, synchro); + if(synchro->comm.mbox) + SIMIX_mbox_remove(synchro->comm.mbox, synchro); xbt_mallocator_release(simix_global->synchro_mallocator, synchro); } @@ -316,19 +316,19 @@ void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro) } } -void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_mailbox_t rdv, +void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_process_t src, smx_mailbox_t mbox, 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){ - smx_synchro_t comm = simcall_HANDLER_comm_isend(simcall, src, rdv, task_size, rate, + smx_synchro_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate, src_buff, src_buff_size, match_fun, NULL, copy_data_fun, data, 0); SIMCALL_SET_MC_VALUE(simcall, 0); simcall_HANDLER_comm_wait(simcall, comm, timeout); } -smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t src_proc, smx_mailbox_t rdv, +smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t src_proc, smx_mailbox_t mbox, double task_size, double rate, void *src_buff, size_t src_buff_size, int (*match_fun)(void *, void *,smx_synchro_t), @@ -336,7 +336,7 @@ smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sr void (*copy_data_fun)(smx_synchro_t, void*, size_t),// used to copy data if not default one void *data, int detached) { - XBT_DEBUG("send from %p", rdv); + XBT_DEBUG("send from %p", mbox); /* Prepare a synchro describing us, so that it gets passed to the user-provided filter of other side */ smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_SEND); @@ -345,22 +345,22 @@ smx_synchro_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_process_t sr * ourself so that the other side also gets a chance of choosing if it wants to match with us. * * If it is not found then push our communication into the rendez-vous point */ - smx_synchro_t other_synchro = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_RECEIVE, match_fun, data, this_synchro); + smx_synchro_t other_synchro = SIMIX_fifo_get_comm(mbox->comm_fifo, SIMIX_COMM_RECEIVE, match_fun, data, this_synchro); if (!other_synchro) { other_synchro = this_synchro; - if (rdv->permanent_receiver!=NULL){ + if (mbox->permanent_receiver!=NULL){ //this mailbox is for small messages, which have to be sent right now other_synchro->state = SIMIX_READY; - other_synchro->comm.dst_proc=rdv->permanent_receiver; + other_synchro->comm.dst_proc=mbox->permanent_receiver; other_synchro->comm.refcount++; - xbt_fifo_push(rdv->done_comm_fifo,other_synchro); - other_synchro->comm.rdv=rdv; - XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", rdv, &(other_synchro->comm)); + xbt_fifo_push(mbox->done_comm_fifo,other_synchro); + other_synchro->comm.mbox=mbox; + XBT_DEBUG("pushing a message into the permanent receive fifo %p, comm %p", mbox, &(other_synchro->comm)); }else{ - SIMIX_rdv_push(rdv, this_synchro); + SIMIX_mbox_push(mbox, this_synchro); } } else { XBT_DEBUG("Receive already pushed"); @@ -405,53 +405,53 @@ 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_process_t receiver, smx_mailbox_t rdv, +void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, 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(receiver, rdv, dst_buff, + smx_synchro_t comm = SIMIX_comm_irecv(receiver, mbox, 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_process_t receiver, smx_mailbox_t rdv, +smx_synchro_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_process_t receiver, smx_mailbox_t mbox, 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(receiver, rdv, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); + return SIMIX_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate); } -smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t rdv, void *dst_buff, size_t *dst_buff_size, +smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox, 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), // used to copy data if not default one void *data, double rate) { - XBT_DEBUG("recv from %p %p", rdv, rdv->comm_fifo); + XBT_DEBUG("recv from %p %p", mbox, mbox->comm_fifo); smx_synchro_t this_synchro = SIMIX_comm_new(SIMIX_COMM_RECEIVE); smx_synchro_t other_synchro; //communication already done, get it inside the fifo of completed comms - if (rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0) { + if (mbox->permanent_receiver && xbt_fifo_size(mbox->done_comm_fifo)!=0) { XBT_DEBUG("We have a comm that has probably already been received, trying to match it, to skip the communication"); //find a match in the already received fifo - other_synchro = SIMIX_fifo_get_comm(rdv->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); + other_synchro = SIMIX_fifo_get_comm(mbox->done_comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); //if not found, assume the receiver came first, register it to the mailbox in the classical way if (!other_synchro) { XBT_DEBUG("We have messages in the permanent receive list, but not the one we are looking for, pushing request into fifo"); other_synchro = this_synchro; - SIMIX_rdv_push(rdv, this_synchro); + SIMIX_mbox_push(mbox, this_synchro); } else { if(other_synchro->comm.surf_comm && SIMIX_comm_get_remains(other_synchro)==0.0) { XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",&(other_synchro->comm)); other_synchro->state = SIMIX_DONE; other_synchro->comm.type = SIMIX_COMM_DONE; - other_synchro->comm.rdv = NULL; + other_synchro->comm.mbox = NULL; } other_synchro->comm.refcount--; SIMIX_comm_destroy(this_synchro); @@ -464,12 +464,12 @@ smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t rdv, void * * ourself so that the other side also gets a chance of choosing if it wants to match with us. * * If it is not found then push our communication into the rendez-vous point */ - other_synchro = SIMIX_fifo_get_comm(rdv->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); + other_synchro = SIMIX_fifo_get_comm(mbox->comm_fifo, SIMIX_COMM_SEND, match_fun, data, this_synchro); if (!other_synchro) { - XBT_DEBUG("Receive pushed first %d", xbt_fifo_size(rdv->comm_fifo)); + XBT_DEBUG("Receive pushed first %d", xbt_fifo_size(mbox->comm_fifo)); other_synchro = this_synchro; - SIMIX_rdv_push(rdv, this_synchro); + SIMIX_mbox_push(mbox, this_synchro); } else { SIMIX_comm_destroy(this_synchro); --smx_total_comms; // this creation was a pure waste @@ -501,17 +501,17 @@ smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t rdv, void * return other_synchro; } -smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t rdv, +smx_synchro_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data){ - return SIMIX_comm_iprobe(simcall->issuer, rdv, type, src, tag, match_fun, data); + return SIMIX_comm_iprobe(simcall->issuer, mbox, type, src, tag, match_fun, data); } -smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t rdv, int type, int src, +smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data) { - XBT_DEBUG("iprobe from %p %p", rdv, rdv->comm_fifo); + XBT_DEBUG("iprobe from %p %p", mbox, mbox->comm_fifo); smx_synchro_t this_synchro; int smx_type; if(type == 1){ @@ -522,19 +522,19 @@ smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t rdv, int t smx_type = SIMIX_COMM_SEND; } smx_synchro_t other_synchro=NULL; - if(rdv->permanent_receiver && xbt_fifo_size(rdv->done_comm_fifo)!=0){ + if(mbox->permanent_receiver && xbt_fifo_size(mbox->done_comm_fifo)!=0){ //find a match in the already received fifo XBT_DEBUG("first try in the perm recv mailbox"); other_synchro = SIMIX_fifo_probe_comm( - rdv->done_comm_fifo, (e_smx_comm_type_t) smx_type, + mbox->done_comm_fifo, (e_smx_comm_type_t) smx_type, match_fun, data, this_synchro); } // }else{ if(!other_synchro){ XBT_DEBUG("try in the normal mailbox"); other_synchro = SIMIX_fifo_probe_comm( - rdv->comm_fifo, (e_smx_comm_type_t) smx_type, + mbox->comm_fifo, (e_smx_comm_type_t) smx_type, match_fun, data, this_synchro); } // } @@ -758,8 +758,8 @@ void SIMIX_comm_finish(smx_synchro_t synchro) } /* If the synchro is still in a rendez-vous point then remove from it */ - if (synchro->comm.rdv) - SIMIX_rdv_remove(synchro->comm.rdv, synchro); + if (synchro->comm.mbox) + SIMIX_mbox_remove(synchro->comm.mbox, synchro); XBT_DEBUG("SIMIX_comm_finish: synchro state = %d", (int)synchro->state); @@ -907,10 +907,10 @@ void SIMIX_post_comm(smx_synchro_t synchro) void SIMIX_comm_cancel(smx_synchro_t synchro) { - /* if the synchro is a waiting state means that it is still in a rdv */ + /* if the synchro is a waiting state means that it is still in a mbox */ /* so remove from it and delete it */ if (synchro->state == SIMIX_WAITING) { - SIMIX_rdv_remove(synchro->comm.rdv, synchro); + SIMIX_mbox_remove(synchro->comm.mbox, synchro); synchro->state = SIMIX_CANCELED; } else if (!MC_is_active() /* when running the MC there are no surf actions */ diff --git a/src/simix/smx_network_private.h b/src/simix/smx_network_private.h index a1039d6551..f2a93b8653 100644 --- a/src/simix/smx_network_private.h +++ b/src/simix/smx_network_private.h @@ -13,33 +13,33 @@ #include "popping_private.h" /** @brief Rendez-vous point datatype */ -typedef struct s_smx_rvpoint { +typedef struct s_smx_mailbox { char *name; xbt_fifo_t comm_fifo; void *data; smx_process_t permanent_receiver; //process which the mailbox is attached to xbt_fifo_t done_comm_fifo;//messages already received in the permanent receive mode -} s_smx_rvpoint_t; +} s_smx_mailbox_t; XBT_PRIVATE void SIMIX_network_init(void); XBT_PRIVATE void SIMIX_network_exit(void); -XBT_PRIVATE smx_mailbox_t SIMIX_rdv_create(const char *name); -XBT_PRIVATE void SIMIX_rdv_destroy(smx_mailbox_t rdv); -XBT_PRIVATE smx_mailbox_t SIMIX_rdv_get_by_name(const char *name); -XBT_PRIVATE void SIMIX_rdv_remove(smx_mailbox_t rdv, smx_synchro_t comm); -XBT_PRIVATE int SIMIX_rdv_comm_count_by_host(smx_mailbox_t rdv, sg_host_t host); -XBT_PRIVATE smx_synchro_t SIMIX_rdv_get_head(smx_mailbox_t rdv); -XBT_PRIVATE void SIMIX_rdv_set_receiver(smx_mailbox_t rdv, smx_process_t proc); -XBT_PRIVATE smx_process_t SIMIX_rdv_get_receiver(smx_mailbox_t rdv); -XBT_PRIVATE smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t rdv, +XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name); +XBT_PRIVATE void SIMIX_mbox_destroy(smx_mailbox_t mbox); +XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char *name); +XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_synchro_t comm); +XBT_PRIVATE int SIMIX_mbox_comm_count_by_host(smx_mailbox_t mbox, sg_host_t host); +XBT_PRIVATE smx_synchro_t SIMIX_mbox_get_head(smx_mailbox_t mbox); +XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_process_t proc); +XBT_PRIVATE smx_process_t SIMIX_mbox_get_receiver(smx_mailbox_t mbox); +XBT_PRIVATE smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size, int (*)(void *, void *, smx_synchro_t), void (*copy_data_fun)(smx_synchro_t, void*, size_t), void *data, double rate); XBT_PRIVATE void SIMIX_comm_destroy(smx_synchro_t synchro); XBT_PRIVATE void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro); -XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t rdv, int type, int src, +XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data); XBT_PRIVATE void SIMIX_post_comm(smx_synchro_t synchro); XBT_PRIVATE void SIMIX_comm_cancel(smx_synchro_t synchro); diff --git a/src/simix/smx_private.h b/src/simix/smx_private.h index caca310451..fa5ffdd232 100644 --- a/src/simix/smx_private.h +++ b/src/simix/smx_private.h @@ -155,11 +155,11 @@ typedef struct s_smx_synchro { struct { e_smx_comm_type_t type; /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */ - smx_mailbox_t rdv; /* Rendez-vous where the comm is queued */ + smx_mailbox_t mbox; /* Rendez-vous where the comm is queued */ #if HAVE_MC - smx_mailbox_t rdv_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR - (comm.rdv set to NULL when the communication is removed from the mailbox + smx_mailbox_t mbox_cpy; /* Copy of the rendez-vous where the comm is queued, MC needs it for DPOR + (comm.mbox set to NULL when the communication is removed from the mailbox (used as garbage collector)) */ #endif int refcount; /* Number of processes involved in the cond */ diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index c2f843f0f9..a6be2497c4 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -117,7 +117,7 @@ void smpi_process_init(int *argc, char ***argv) data->argc = argc; data->argv = argv; // set the process attached to the mailbox - simcall_rdv_set_receiver(data->mailbox_small, proc); + simcall_mbox_set_receiver(data->mailbox_small, proc); XBT_DEBUG("<%d> New process in the game: %p", index, proc); } xbt_assert(smpi_process_data(), @@ -412,8 +412,8 @@ void smpi_global_init(void) //process_data[i]->index = i; process_data[i]->argc = NULL; process_data[i]->argv = NULL; - process_data[i]->mailbox = simcall_rdv_create(get_mailbox_name(name, i)); - process_data[i]->mailbox_small = simcall_rdv_create(get_mailbox_name_small(name, i)); + process_data[i]->mailbox = simcall_mbox_create(get_mailbox_name(name, i)); + process_data[i]->mailbox_small = simcall_mbox_create(get_mailbox_name_small(name, i)); process_data[i]->mailboxes_mutex = xbt_mutex_init(); process_data[i]->timer = xbt_os_timer_new(); if (MC_is_active()) @@ -460,8 +460,8 @@ void smpi_global_destroy(void) smpi_comm_destroy(process_data[i]->comm_intra); } xbt_os_timer_free(process_data[i]->timer); - simcall_rdv_destroy(process_data[i]->mailbox); - simcall_rdv_destroy(process_data[i]->mailbox_small); + simcall_mbox_destroy(process_data[i]->mailbox); + simcall_mbox_destroy(process_data[i]->mailbox_small); xbt_mutex_destroy(process_data[i]->mailboxes_mutex); xbt_free(process_data[i]); }