*/
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);
-
/* Process creation/destruction callbacks */
typedef void (*void_pfn_smxprocess_t) (smx_process_t);
/* for auto-restart function */
XBT_PUBLIC(int) simcall_comm_test(smx_synchro_t comm);
XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms);
-/* Getters and setters */
-XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_synchro_t comm);
-XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_synchro_t comm);
-XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_synchro_t comm);
-XBT_PUBLIC(smx_process_t) simcall_comm_get_dst_proc(smx_synchro_t comm);
-
/************************** Tracing handling **********************************/
XBT_PUBLIC(void) simcall_set_category(smx_synchro_t synchro, const char *category);
* \param buff the data copied
* \param buff_size size of the buffer
*/
-void MSG_comm_copy_data_from_SIMIX(smx_synchro_t comm, void* buff, size_t buff_size) {
- // copy the task
+void MSG_comm_copy_data_from_SIMIX(smx_synchro_t synchro, void* buff, size_t buff_size)
+{
+ simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
+
SIMIX_comm_copy_pointer_callback(comm, buff, buff_size);
// notify the user callback if any
if (msg_global->task_copy_callback) {
msg_task_t task = (msg_task_t) buff;
- msg_global->task_copy_callback(task, simcall_comm_get_src_proc(comm), simcall_comm_get_dst_proc(comm));
+ msg_global->task_copy_callback(task, comm->src_proc, comm->dst_proc);
}
}
msg_task_t MSG_mailbox_front(msg_mailbox_t mailbox)
{
- smx_synchro_t comm = simcall_mbox_front(mailbox);
+ simgrid::simix::Comm* comm = static_cast<simgrid::simix::Comm*>(simcall_mbox_front(mailbox));
if (!comm)
return NULL;
- return (msg_task_t) simcall_comm_get_src_data(comm);
+ return (msg_task_t) comm->src_data;
}
msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
return simcall_BODY_comm_test(comm);
}
-/**
- * \ingroup simix_comm_management
- *
- */
-void *simcall_comm_get_src_data(smx_synchro_t comm)
-{
- return simcall_BODY_comm_get_src_data(comm);
-}
-
-/**
- * \ingroup simix_comm_management
- *
- */
-void *simcall_comm_get_dst_data(smx_synchro_t comm)
-{
- return simcall_BODY_comm_get_dst_data(comm);
-}
-
-/**
- * \ingroup simix_comm_management
- *
- */
-smx_process_t simcall_comm_get_src_proc(smx_synchro_t comm)
-{
- return simcall_BODY_comm_get_src_proc(comm);
-}
-
-/**
- * \ingroup simix_comm_management
- *
- */
-smx_process_t simcall_comm_get_dst_proc(smx_synchro_t comm)
-{
- return simcall_BODY_comm_get_dst_proc(comm);
-}
-
/**
* \ingroup simix_synchro_management
*
simcall->result.i = result;
}
-static inline smx_synchro_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall) {
- return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_comm_get_src_data__set__comm(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline void* simcall_comm_get_src_data__get__result(smx_simcall_t simcall){
- return simcall->result.dp;
-}
-static inline void simcall_comm_get_src_data__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
-static inline smx_synchro_t simcall_comm_get_dst_data__get__comm(smx_simcall_t simcall) {
- return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_comm_get_dst_data__set__comm(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline void* simcall_comm_get_dst_data__get__result(smx_simcall_t simcall){
- return simcall->result.dp;
-}
-static inline void simcall_comm_get_dst_data__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
-static inline smx_synchro_t simcall_comm_get_src_proc__get__comm(smx_simcall_t simcall) {
- return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_comm_get_src_proc__set__comm(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline smx_process_t simcall_comm_get_src_proc__get__result(smx_simcall_t simcall){
- return (smx_process_t) simcall->result.dp;
-}
-static inline void simcall_comm_get_src_proc__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
-static inline smx_synchro_t simcall_comm_get_dst_proc__get__comm(smx_simcall_t simcall) {
- return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_comm_get_dst_proc__set__comm(smx_simcall_t simcall, void* arg) {
- simcall->args[0].dp = arg;
-}
-static inline smx_process_t simcall_comm_get_dst_proc__get__result(smx_simcall_t simcall){
- return (smx_process_t) simcall->result.dp;
-}
-static inline void simcall_comm_get_dst_proc__set__result(smx_simcall_t simcall, void* result){
- simcall->result.dp = result;
-}
-
static inline smx_mutex_t simcall_mutex_init__get__result(smx_simcall_t simcall){
return (smx_mutex_t) simcall->result.dp;
}
return (int) self->simcall.result.i;
}
-inline static void* simcall_BODY_comm_get_src_data(smx_synchro_t comm) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_comm_get_src_data(comm);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_COMM_GET_SRC_DATA;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) comm;
- 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);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
- return (void*) self->simcall.result.dp;
- }
-
-inline static void* simcall_BODY_comm_get_dst_data(smx_synchro_t comm) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_comm_get_dst_data(comm);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_COMM_GET_DST_DATA;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) comm;
- 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);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
- return (void*) self->simcall.result.dp;
- }
-
-inline static smx_process_t simcall_BODY_comm_get_src_proc(smx_synchro_t comm) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_comm_get_src_proc(comm);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_COMM_GET_SRC_PROC;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) comm;
- 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);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
- return (smx_process_t) self->simcall.result.dp;
- }
-
-inline static smx_process_t simcall_BODY_comm_get_dst_proc(smx_synchro_t comm) {
- smx_process_t self = SIMIX_process_self();
-
- /* Go to that function to follow the code flow through the simcall barrier */
- if (0) SIMIX_comm_get_dst_proc(comm);
- /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
- self->simcall.call = SIMCALL_COMM_GET_DST_PROC;
- memset(&self->simcall.result, 0, sizeof(self->simcall.result));
- memset(self->simcall.args, 0, sizeof(self->simcall.args));
- self->simcall.args[0].dp = (void*) comm;
- 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);
- SIMIX_process_yield(self);
- } else {
- SIMIX_simcall_handle(&self->simcall, 0);
- }
- return (smx_process_t) self->simcall.result.dp;
- }
-
inline static smx_mutex_t simcall_BODY_mutex_init() {
smx_process_t self = SIMIX_process_self();
SIMCALL_COMM_WAIT,
SIMCALL_COMM_TEST,
SIMCALL_COMM_TESTANY,
- SIMCALL_COMM_GET_SRC_DATA,
- SIMCALL_COMM_GET_DST_DATA,
- SIMCALL_COMM_GET_SRC_PROC,
- SIMCALL_COMM_GET_DST_PROC,
SIMCALL_MUTEX_INIT,
SIMCALL_MUTEX_LOCK,
SIMCALL_MUTEX_TRYLOCK,
"SIMCALL_COMM_WAIT",
"SIMCALL_COMM_TEST",
"SIMCALL_COMM_TESTANY",
- "SIMCALL_COMM_GET_SRC_DATA",
- "SIMCALL_COMM_GET_DST_DATA",
- "SIMCALL_COMM_GET_SRC_PROC",
- "SIMCALL_COMM_GET_DST_PROC",
"SIMCALL_MUTEX_INIT",
"SIMCALL_MUTEX_LOCK",
"SIMCALL_MUTEX_TRYLOCK",
simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp);
break;
-case SIMCALL_COMM_GET_SRC_DATA:
- simcall->result.dp = SIMIX_comm_get_src_data((smx_synchro_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_COMM_GET_DST_DATA:
- simcall->result.dp = SIMIX_comm_get_dst_data((smx_synchro_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_COMM_GET_SRC_PROC:
- simcall->result.dp = SIMIX_comm_get_src_proc((smx_synchro_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
-case SIMCALL_COMM_GET_DST_PROC:
- simcall->result.dp = SIMIX_comm_get_dst_proc((smx_synchro_t) simcall->args[0].dp);
- SIMIX_simcall_answer(simcall);
- break;
-
case SIMCALL_MUTEX_INIT:
simcall->result.dp = simcall_HANDLER_mutex_init(simcall );
SIMIX_simcall_answer(simcall);
Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double)
Blck H comm_test (int) (comm, void*, smx_synchro_t)
Blck H comm_testany (int) (comms, void*, xbt_dynar_t)
-Func - comm_get_src_data (void*) (comm, void*, smx_synchro_t)
-Func - comm_get_dst_data (void*) (comm, void*, smx_synchro_t)
-Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t)
-Func - comm_get_dst_proc (void*, smx_process_t) (comm, void*, smx_synchro_t)
Func H mutex_init (void*, smx_mutex_t)
Blck H mutex_lock (void) (mutex, void*, smx_mutex_t)
}
}
-/************* synchro Getters **************/
-
-/**
- * \brief Return the user data associated to the sender of the communication
- * \param synchro The communication
- * \return the user data
- */
-void* SIMIX_comm_get_src_data(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->src_data;
-}
-
-/**
- * \brief Return the user data associated to the receiver of the communication
- * \param synchro The communication
- * \return the user data
- */
-void* SIMIX_comm_get_dst_data(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->dst_data;
-}
-
-smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->src_proc;
-}
-
-smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro)
-{
- simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
- return comm->dst_proc;
-}
-
/******************************************************************************/
/* SIMIX_comm_copy_data callbacks */
/******************************************************************************/
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 smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro);
-XBT_PRIVATE smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro);
#endif
}
if (request->action){
- MPI_Request req = (MPI_Request)SIMIX_comm_get_src_data(request->action);
+ simgrid::simix::Comm *sync_comm = static_cast<simgrid::simix::Comm*>(request->action);
+ MPI_Request req = (MPI_Request)sync_comm->src_data;
*flag = 1;
if(status != MPI_STATUS_IGNORE && !(req->flags & PREPARED)) {
status->MPI_SOURCE = smpi_group_rank(smpi_comm_group(comm), req->src);