Switch to MSG_task_{send,recv} instead, or compile Simgrid command line
'cmake -Dcustom_flags="-DMSG_USE_DEPRECATED" .' if you really need to
use these (crappy) functions in your code.
- These functions will be removed at some point. Stop using them now.
+ These functions will be removed soon. Stop using them now.
* Deprecate MSG_get_host_{table,number}
Implement MSG_hosts_as_dynar() instead.
* Implement MSG_processes_as_dynar() (Closes gforge #13642)
+ * Remove the public field msg_host_t->name. Use MSG_host_get_name()
Simix:
* Stabilize the parallel execution mode of user contexts
include/xbt/file_stat.h
include/simgrid/platf.h
include/simgrid/modelchecker.h
+ include/simgrid/simix.h
include/msg/msg.h
include/msg/datatypes.h
include/simdag/simdag.h
include/instr/instr.h
include/gras.h
include/xbt.h
- include/simix/simix.h
- include/simix/datatypes.h
- include/simix/context.h
)
set(source_of_generated_headers
include/simgrid_config.h.in
#include <stdio.h>
#include <stdlib.h>
#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
-#include "simix/simix.h" /* semaphores for the barrier */
+#include "simgrid/simix.h" /* semaphores for the barrier */
#include "xbt.h" /* calloc, printf */
#include "instr/instr_private.h"
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("\t %s", slaves[i]->name);
+ XBT_INFO("\t %s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
XBT_INFO("Got %d slave(s) :", slaves_count);
for (i = 0; i < slaves_count; i++)
- XBT_INFO("%s", slaves[i]->name);
+ XBT_INFO("%s", MSG_host_get_name(slaves[i]));
XBT_INFO("Got %d task to process :", number_of_tasks);
} else if (a == MSG_TRANSFER_FAILURE) {
XBT_INFO
("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
free(task->data);
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
free(task->data);
MSG_task_destroy(task);
} else {
return 0;
} else if (a == MSG_TRANSFER_FAILURE) {
XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
- slaves[i]->name);
+ MSG_host_get_name(slaves[i]));
MSG_task_destroy(task);
} else if (a == MSG_TIMEOUT) {
XBT_INFO
("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
- slaves[i % slaves_count]->name);
+ MSG_host_get_name(slaves[i % slaves_count]));
MSG_task_destroy(task);
} else {
XBT_INFO("Hey ?! What's up ? ");
- xbt_die("Unexpected behavior with '%s': %d", slaves[i]->name, a);
+ xbt_die("Unexpected behavior with '%s': %d", MSG_host_get_name(slaves[i]), a);
}
}
XBT_INFO("Got %d slaves and %d tasks to process", slaves_count,
number_of_tasks);
for (i = 0; i < slaves_count; i++)
- XBT_DEBUG("%s", slaves[i]->name);
+ XBT_DEBUG("%s", MSG_host_get_name(slaves[i]));
for (i = 0; i < number_of_tasks; i++) {
XBT_INFO("Sending \"%s\" to \"%s\"",
- todo[i]->name, slaves[i % slaves_count]->name);
+ todo[i]->name, MSG_host_get_name(slaves[i % slaves_count]));
if (MSG_host_self() == slaves[i % slaves_count]) {
XBT_INFO("Hey ! It's me ! :)");
}
break;
}
XBT_INFO("Sending \"%s\" to \"%s\"",
- MSG_task_get_name(task), slaves[i % slaves_count]->name);
+ MSG_task_get_name(task), MSG_host_get_name(slaves[i % slaves_count]));
MSG_task_send(task, MSG_host_get_name(slaves[i % slaves_count]));
i++;
} else {
xbt_mutex_release(mutex);
MSG_process_suspend(MSG_process_self());
m_host_t h = MSG_process_get_host(MSG_process_self());
- XBT_INFO("I've been moved on this new host: %s", h->name);
+ XBT_INFO("I've been moved on this new host: %s", MSG_host_get_name(h));
XBT_INFO("Uh, nothing to do here. Stopping now");
return 0;
} /* end_of_emigrant */
long slaves_count = atol(argv[4]);
//setting the variable "is_master" (previously declared) to value 1
- TRACE_host_variable_set(MSG_host_self()->name, "is_master", 1);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_master", 1);
TRACE_mark("msmark", "start_send_tasks");
int i;
task = MSG_task_create("task", task_comp_size, task_comm_size, NULL);
//setting the variable "task_creation" to value i
- TRACE_host_variable_set(MSG_host_self()->name, "task_creation", i);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "task_creation", i);
//setting the category of task to "compute"
//the category of a task must be defined before it is sent or executed
{
m_task_t task = NULL;
- TRACE_host_variable_set(MSG_host_self()->name, "is_slave", 1);
+ TRACE_host_variable_set(MSG_host_get_name(MSG_host_self()), "is_slave", 1);
while (1) {
MSG_task_receive(&(task), "master_mailbox");
}
//adding the value returned by MSG_task_get_compute_duration(task)
//to the variable "task_computation"
- TRACE_host_variable_add(MSG_host_self()->name,
+ TRACE_host_variable_add(MSG_host_get_name(MSG_host_self()),
"task_computation",
MSG_task_get_compute_duration(task));
MSG_task_execute(task);
int master(int argc, char *argv[])
{
- char *hostname = MSG_host_self()->name;
+ const char *hostname = MSG_host_get_name(MSG_host_self());
int i;
//the hostname has an empty HDD with a capacity of 100000 (bytes)
#define MSG_DATATYPE_H
#include "xbt/misc.h"
#include "xbt/file_stat.h"
+#include "simgrid/simix.h"
#include "simgrid_config.h" // for HAVE_TRACING
SG_BEGIN_DECL()
-/* ******************************** Host ************************************ */
+/* ******************************** Mailbox ************************************ */
+
+/** @brief Mailbox datatype
+ * @ingroup msg_task_usage
+ *
+ * Object representing a communication rendez-vous point, on which
+ * the sender finds the receiver it wants to communicate with. As a
+ * MSG user, you will only rarely manipulate any of these objects
+ * directly, since most of the public interface (such as
+ * #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 simdata_host *simdata_host_t;
+
+/* ******************************** Host ************************************ */
typedef struct m_host {
- char *name; /**< @brief host name if any */
- simdata_host_t simdata; /**< @brief simulator data */
- void *data; /**< @brief user data */
+ smx_host_t smx_host; /**< SIMIX representation of this host */
+#ifdef MSG_USE_DEPRECATED
+ msg_mailbox_t *mailboxes; /**< the channels */
+#endif
} s_m_host_t;
/** @brief Host datatype
typedef int m_channel_t;
#endif
-/* ******************************** Mailbox ************************************ */
-
-/** @brief Mailbox datatype
- * @ingroup msg_task_usage
- *
- * Object representing a communication rendez-vous point, on which
- * the sender finds the receiver it wants to communicate with. As a
- * MSG user, you will only rarely manipulate any of these objects
- * directly, since most of the public interface (such as
- * #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;
SG_END_DECL()
#include "msg/datatypes.h"
#include "xbt/automaton.h"
+#include "simgrid/simix.h"
+
SG_BEGIN_DECL()
/** @brief Return code of most MSG functions
XBT_PUBLIC(msg_comm_t) MSG_task_isend(m_task_t task, const char *alias);
XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(m_task_t task,
const char *alias,
- int (*match_fun)(void*,void*),
+ int (*match_fun)(void*,void*, smx_action_t),
void *match_data);
XBT_PUBLIC(void) MSG_task_dsend(m_task_t task, const char *alias, void_f_pvoid_t cleanup);
#include "instr/instr.h"
/* Used only by the bindings */
-#include "simix/simix.h"
XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(m_process_t process);
SG_END_DECL()
#include "xbt/dict.h"
#include "xbt/file_stat.h"
#include "xbt/function_types.h"
-#include "simix/datatypes.h"
-#include "simix/context.h"
+#include "xbt/parmap.h"
+#include "xbt/swag.h"
SG_BEGIN_DECL()
+
+/* ******************************** Host ************************************ */
+/** @defgroup m_datatypes_management_details Details on SIMIX datatypes */
+/** @brief Host datatype
+ @ingroup m_datatypes_management
+
+ A <em>location</em> (or <em>host</em>) is any possible place where
+ a process may run. Thus it is represented as a <em>physical
+ resource with computing capabilities</em>, some <em>mailboxes</em>
+ to enable running process to communicate with remote ones, and
+ some <em>private data</em> that can be only accessed by local
+ process.
+
+ \see m_host_management
+ @{ */
+typedef struct s_smx_host *smx_host_t;
+typedef enum {
+ SIMIX_WAITING,
+ SIMIX_READY,
+ SIMIX_RUNNING,
+ SIMIX_DONE,
+ SIMIX_CANCELED,
+ SIMIX_FAILED,
+ SIMIX_SRC_HOST_FAILURE,
+ SIMIX_DST_HOST_FAILURE,
+ SIMIX_SRC_TIMEOUT,
+ SIMIX_DST_TIMEOUT,
+ SIMIX_LINK_FAILURE
+} e_smx_state_t;
+/** @} */
+
+
+typedef struct s_smx_timer* smx_timer_t;
+
+/* ******************************** Synchro ************************************ */
+typedef struct s_smx_mutex *smx_mutex_t;
+typedef struct s_smx_cond *smx_cond_t;
+typedef struct s_smx_sem *smx_sem_t;
+
+/********************************** File *************************************/
+typedef struct s_smx_file *smx_file_t;
+typedef struct s_smx_stat *smx_stat_t;
+
+/********************************** Action *************************************/
+typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
+
+
+
+/* ****************************** Process *********************************** */
+/** @brief Process datatype
+ @ingroup m_datatypes_management
+
+ A processt may be defined as a <em>code</em>, with some <em>private
+ data</em>, executing in a <em>location</em>.
+ \see m_process_management
+ @{ */
+typedef struct s_smx_process *smx_process_t;
+/** @} */
+
+
+/*
+ * Type of function that creates a process.
+ * The function must accept the following parameters:
+ * void* process: the process created will be stored there
+ * const char *name: a name for the object. It is for user-level information and can be NULL
+ * xbt_main_func_t code: is a function describing the behavior of the process
+ * void *data: data a pointer to any data one may want to attach to the new object.
+ * smx_host_t host: the location where the new process is executed
+ * int argc, char **argv: parameters passed to code
+ * xbt_dict_t pros: properties
+ */
+typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
+ /* name */ const char*,
+ /* code */ xbt_main_func_t,
+ /* userdata */ void*,
+ /* hostname */ const char*,
+ /* kill_time */ double,
+ /* argc */ int,
+ /* argv */ char**,
+ /* props */ xbt_dict_t);
+
+
+/******************************* Networking ***********************************/
+typedef struct s_smx_rvpoint *smx_rdv_t;
+
+/******************************** Context *************************************/
+typedef struct s_smx_context *smx_context_t;
+typedef struct s_smx_context_factory *smx_context_factory_t;
+
+/* Process creation/destruction callbacks */
+typedef void (*void_pfn_smxprocess_t) (smx_process_t);
+
+
+/* The following function pointer types describe the interface that any context
+ factory should implement */
+
+
+typedef smx_context_t(*smx_pfn_context_factory_create_context_t)
+ (xbt_main_func_t, int, char **, void_pfn_smxprocess_t, void* data);
+typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*);
+typedef void (*smx_pfn_context_free_t) (smx_context_t);
+typedef void (*smx_pfn_context_start_t) (smx_context_t);
+typedef void (*smx_pfn_context_stop_t) (smx_context_t);
+typedef void (*smx_pfn_context_suspend_t) (smx_context_t context);
+typedef void (*smx_pfn_context_runall_t) (void);
+typedef smx_context_t (*smx_pfn_context_self_t) (void);
+typedef void* (*smx_pfn_context_get_data_t) (smx_context_t context);
+
+/* interface of the context factories */
+typedef struct s_smx_context_factory {
+ const char *name;
+ smx_pfn_context_factory_create_context_t create_context;
+ smx_pfn_context_factory_finalize_t finalize;
+ smx_pfn_context_free_t free;
+ smx_pfn_context_stop_t stop;
+ smx_pfn_context_suspend_t suspend;
+ smx_pfn_context_runall_t runall;
+ smx_pfn_context_self_t self;
+ smx_pfn_context_get_data_t get_data;
+} s_smx_context_factory_t;
+
+/* Hack: let msg load directly the right factory */
+typedef void (*smx_ctx_factory_initializer_t)(smx_context_factory_t*);
+XBT_PUBLIC(smx_ctx_factory_initializer_t) smx_factory_initializer_to_use;
+extern char* smx_context_factory_name;
+extern int smx_context_stack_size;
+
+#ifdef HAVE_THREAD_LOCAL_STORAGE
+extern __thread smx_context_t smx_current_context;
+#else
+extern smx_context_t smx_current_context;
+#endif
+
+/* *********************** */
+/* Context type definition */
+/* *********************** */
+/* the following function pointers types describe the interface that all context
+ concepts must implement */
+/* each context type derive from this structure, so they must contain this structure
+ * at their beginning -- OOP in C :/ */
+typedef struct s_smx_context {
+ s_xbt_swag_hookup_t hookup;
+ xbt_main_func_t code;
+ void_pfn_smxprocess_t cleanup_func;
+ void *data; /* Here SIMIX stores the smx_process_t containing the context */
+ char **argv;
+ int argc;
+ int iwannadie:1;
+} s_smx_ctx_base_t;
+
+/* methods of this class */
+XBT_PUBLIC(void) smx_ctx_base_factory_init(smx_context_factory_t *factory);
+XBT_PUBLIC(int) smx_ctx_base_factory_finalize(smx_context_factory_t *factory);
+
+XBT_PUBLIC(smx_context_t)
+smx_ctx_base_factory_create_context_sized(size_t size,
+ xbt_main_func_t code, int argc,
+ char **argv,
+ void_pfn_smxprocess_t cleanup,
+ void* data);
+XBT_PUBLIC(void) smx_ctx_base_free(smx_context_t context);
+XBT_PUBLIC(void) smx_ctx_base_stop(smx_context_t context);
+XBT_PUBLIC(smx_context_t) smx_ctx_base_self(void);
+XBT_PUBLIC(void) *smx_ctx_base_get_data(smx_context_t context);
+
+XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
+XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
+XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar(void);
+
+/* parallelism */
+XBT_PUBLIC(int) SIMIX_context_is_parallel(void);
+XBT_PUBLIC(int) SIMIX_context_get_nthreads(void);
+XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
+XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
+XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
+XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
+XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
+
+
+
/********************************** Global ************************************/
/* Initialization and exit */
XBT_PUBLIC(void) SIMIX_global_init(int *argc, char **argv);
XBT_PUBLIC(void) simcall_comm_send(smx_rdv_t rdv, double task_size,
double rate, void *src_buff,
size_t src_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void *data, double timeout);
XBT_PUBLIC(smx_action_t) simcall_comm_isend(smx_rdv_t rdv, double task_size,
double rate, void *src_buff,
size_t src_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void (*clean_fun)(void *),
void *data, int detached);
XBT_PUBLIC(void) simcall_comm_recv(smx_rdv_t rdv, void *dst_buff,
size_t * dst_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void *data, double timeout);
XBT_PUBLIC(smx_action_t) simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff,
size_t * dst_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void *data);
XBT_PUBLIC(void) simcall_comm_destroy(smx_action_t comm);
+++ /dev/null
-/* a fast and simple context switching library */
-
-/* Copyright (c) 2009, 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef _SIMIX_CONTEXT_H
-#define _SIMIX_CONTEXT_H
-
-#include "xbt/swag.h"
-#include "xbt/parmap.h"
-#include "simix/datatypes.h"
-#include "simgrid_config.h"
-
-SG_BEGIN_DECL()
-/******************************** Context *************************************/
-typedef struct s_smx_context *smx_context_t;
-typedef struct s_smx_context_factory *smx_context_factory_t;
-
-/* Process creation/destruction callbacks */
-typedef void (*void_pfn_smxprocess_t) (smx_process_t);
-
-
-/* The following function pointer types describe the interface that any context
- factory should implement */
-
-
-typedef smx_context_t(*smx_pfn_context_factory_create_context_t)
- (xbt_main_func_t, int, char **, void_pfn_smxprocess_t, void* data);
-typedef int (*smx_pfn_context_factory_finalize_t) (smx_context_factory_t*);
-typedef void (*smx_pfn_context_free_t) (smx_context_t);
-typedef void (*smx_pfn_context_start_t) (smx_context_t);
-typedef void (*smx_pfn_context_stop_t) (smx_context_t);
-typedef void (*smx_pfn_context_suspend_t) (smx_context_t context);
-typedef void (*smx_pfn_context_runall_t) (void);
-typedef smx_context_t (*smx_pfn_context_self_t) (void);
-typedef void* (*smx_pfn_context_get_data_t) (smx_context_t context);
-
-/* interface of the context factories */
-typedef struct s_smx_context_factory {
- const char *name;
- smx_pfn_context_factory_create_context_t create_context;
- smx_pfn_context_factory_finalize_t finalize;
- smx_pfn_context_free_t free;
- smx_pfn_context_stop_t stop;
- smx_pfn_context_suspend_t suspend;
- smx_pfn_context_runall_t runall;
- smx_pfn_context_self_t self;
- smx_pfn_context_get_data_t get_data;
-} s_smx_context_factory_t;
-
-/* Hack: let msg load directly the right factory */
-typedef void (*smx_ctx_factory_initializer_t)(smx_context_factory_t*);
-XBT_PUBLIC(smx_ctx_factory_initializer_t) smx_factory_initializer_to_use;
-extern char* smx_context_factory_name;
-extern int smx_context_stack_size;
-
-#ifdef HAVE_THREAD_LOCAL_STORAGE
-extern __thread smx_context_t smx_current_context;
-#else
-extern smx_context_t smx_current_context;
-#endif
-
-/* *********************** */
-/* Context type definition */
-/* *********************** */
-/* the following function pointers types describe the interface that all context
- concepts must implement */
-/* each context type derive from this structure, so they must contain this structure
- * at their beginning -- OOP in C :/ */
-typedef struct s_smx_context {
- s_xbt_swag_hookup_t hookup;
- xbt_main_func_t code;
- void_pfn_smxprocess_t cleanup_func;
- void *data; /* Here SIMIX stores the smx_process_t containing the context */
- char **argv;
- int argc;
- int iwannadie:1;
-} s_smx_ctx_base_t;
-
-/* methods of this class */
-XBT_PUBLIC(void) smx_ctx_base_factory_init(smx_context_factory_t *factory);
-XBT_PUBLIC(int) smx_ctx_base_factory_finalize(smx_context_factory_t *factory);
-
-XBT_PUBLIC(smx_context_t)
-smx_ctx_base_factory_create_context_sized(size_t size,
- xbt_main_func_t code, int argc,
- char **argv,
- void_pfn_smxprocess_t cleanup,
- void* data);
-XBT_PUBLIC(void) smx_ctx_base_free(smx_context_t context);
-XBT_PUBLIC(void) smx_ctx_base_stop(smx_context_t context);
-XBT_PUBLIC(smx_context_t) smx_ctx_base_self(void);
-XBT_PUBLIC(void) *smx_ctx_base_get_data(smx_context_t context);
-
-XBT_PUBLIC(xbt_dynar_t) SIMIX_process_get_runnable(void);
-XBT_PUBLIC(smx_process_t) SIMIX_process_from_PID(int PID);
-XBT_PUBLIC(xbt_dynar_t) SIMIX_processes_as_dynar(void);
-
-/* parallelism */
-XBT_PUBLIC(int) SIMIX_context_is_parallel(void);
-XBT_PUBLIC(int) SIMIX_context_get_nthreads(void);
-XBT_PUBLIC(void) SIMIX_context_set_nthreads(int nb_threads);
-XBT_PUBLIC(int) SIMIX_context_get_parallel_threshold(void);
-XBT_PUBLIC(void) SIMIX_context_set_parallel_threshold(int threshold);
-XBT_PUBLIC(e_xbt_parmap_mode_t) SIMIX_context_get_parallel_mode(void);
-XBT_PUBLIC(void) SIMIX_context_set_parallel_mode(e_xbt_parmap_mode_t mode);
-
-SG_END_DECL()
-
-#endif /* !_XBT_CONTEXT_H */
+++ /dev/null
-/* Copyright (c) 2007, 2009, 2010. The SimGrid Team.
- * All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef _SIMIX_DATATYPES_H
-#define _SIMIX_DATATYPES_H
-#include "xbt/misc.h"
-#include "xbt/swag.h"
-#include "xbt/fifo.h"
-#include "xbt/dict.h"
-
-SG_BEGIN_DECL()
-
-/* ******************************** Host ************************************ */
-/** @defgroup m_datatypes_management_details Details on SIMIX datatypes */
-/** @brief Host datatype
- @ingroup m_datatypes_management
-
- A <em>location</em> (or <em>host</em>) is any possible place where
- a process may run. Thus it is represented as a <em>physical
- resource with computing capabilities</em>, some <em>mailboxes</em>
- to enable running process to communicate with remote ones, and
- some <em>private data</em> that can be only accessed by local
- process.
-
- \see m_host_management
- @{ */
-typedef struct s_smx_host *smx_host_t;
-typedef enum {
- SIMIX_WAITING,
- SIMIX_READY,
- SIMIX_RUNNING,
- SIMIX_DONE,
- SIMIX_CANCELED,
- SIMIX_FAILED,
- SIMIX_SRC_HOST_FAILURE,
- SIMIX_DST_HOST_FAILURE,
- SIMIX_SRC_TIMEOUT,
- SIMIX_DST_TIMEOUT,
- SIMIX_LINK_FAILURE
-} e_smx_state_t;
-/** @} */
-
-
-typedef struct s_smx_timer* smx_timer_t;
-
-/* ******************************** Synchro ************************************ */
-typedef struct s_smx_mutex *smx_mutex_t;
-typedef struct s_smx_cond *smx_cond_t;
-typedef struct s_smx_sem *smx_sem_t;
-
-/********************************** File *************************************/
-typedef struct s_smx_file *smx_file_t;
-typedef struct s_smx_stat *smx_stat_t;
-
-/********************************** Action *************************************/
-typedef struct s_smx_action *smx_action_t; /* FIXME: replace by specialized action handlers */
-
-
-
-/* ****************************** Process *********************************** */
-/** @brief Process datatype
- @ingroup m_datatypes_management
-
- A processt may be defined as a <em>code</em>, with some <em>private
- data</em>, executing in a <em>location</em>.
- \see m_process_management
- @{ */
-typedef struct s_smx_process *smx_process_t;
-/** @} */
-
-
-/*
- * Type of function that creates a process.
- * The function must accept the following parameters:
- * void* process: the process created will be stored there
- * const char *name: a name for the object. It is for user-level information and can be NULL
- * xbt_main_func_t code: is a function describing the behavior of the process
- * void *data: data a pointer to any data one may want to attach to the new object.
- * smx_host_t host: the location where the new process is executed
- * int argc, char **argv: parameters passed to code
- * xbt_dict_t pros: properties
- */
-typedef void (*smx_creation_func_t) ( /* process */ smx_process_t*,
- /* name */ const char*,
- /* code */ xbt_main_func_t,
- /* userdata */ void*,
- /* hostname */ const char*,
- /* kill_time */ double,
- /* argc */ int,
- /* argv */ char**,
- /* props */ xbt_dict_t);
-
-
-/******************************* Networking ***********************************/
-typedef struct s_smx_rvpoint *smx_rdv_t;
-
-
-SG_END_DECL()
-#endif
XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(gras_msg);
typedef void *gras_trp_bufdata_;
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "simix/smx_private.h"
/* Yeah, the following is awfull, breaking the encapsulation of at least 3 modules
#define GRAS_TRP_INTERFACE_H
#include "portable.h" /* sometimes needed for fd_set */
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "xbt/queue.h"
/* Data of this module specific to each process
#include "xbt/ex.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "gras/Msg/msg_private.h"
#include "gras/Transport/transport_private.h"
#include "gras/Virtu/virtu_sg.h"
#include "xbt/dynar.h"
#include "gras/Virtu/virtu_interface.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "gras/Msg/msg_private.h"
/** @brief Data for each process */
#include "gras/Virtu/virtu_private.h"
#include "xbt/dynar.h"
-#include "simix/simix.h" /* SimGrid header */
+#include "simgrid/simix.h" /* SimGrid header */
#include "gras/Transport/transport_private.h"
typedef struct {
#include "xbt_modinter.h"
#include "xbt/sysdep.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
void SIMIX_display_process_status(void)
{
#include "xbt/dict.h"
#include "xbt/function_types.h"
#include "mc/datatypes.h"
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "simgrid/modelchecker.h" /* our public interface (and definition of HAVE_MC) */
#include "xbt/automaton.h"
#include "xbt/misc.h" /* XBT_PUBLIC(), SG_BEGIN_DECL() and SG_END_DECL() definitions */
#include "xbt/function_types.h" /* function pointer types declarations */
#include "xbt_modinter.h" /* xbt_context_init() and xbt_context_exit() declarations */
-#include "simix/simix.h"
+#include "simgrid/simix.h"
SG_BEGIN_DECL()
PJ_container_free(existing_container);
//create new container on the new_host location
- msg = PJ_container_new(instr_process_id(process, str, len), INSTR_MSG_PROCESS, PJ_container_get(new_host->name));
+ msg = PJ_container_new(instr_process_id(process, str, len), INSTR_MSG_PROCESS, PJ_container_get(SIMIX_host_get_name(new_host->smx_host)));
//end link
msg = PJ_container_get(instr_process_id(process, str, len));
int len = INSTR_DEFAULT_STR_SIZE;
char str[INSTR_DEFAULT_STR_SIZE];
- container_t host_container = PJ_container_get (host->name);
+ container_t host_container = PJ_container_get (SIMIX_host_get_name(host->smx_host));
PJ_container_new(instr_process_id_2(process_name, process_pid, str, len), INSTR_MSG_PROCESS, host_container);
}
}
#include "msg_private.h"
#include "xbt/sysdep.h"
#include "xbt/log.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
/** \brief set a configuration variable
*
/* Initialize MSG hosts */
xbt_lib_foreach(host_lib, cursor, name, data) {
if(data[SIMIX_HOST_LEVEL])
- __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL], NULL);
+ __MSG_host_create((smx_host_t)data[SIMIX_HOST_LEVEL]);
}
}
p_simdata = SIMIX_process_self_get_data(self);
simdata->isused=1;
simdata->compute =
- simcall_host_execute(task->name, p_simdata->m_host->simdata->smx_host,
+ simcall_host_execute(task->name, p_simdata->m_host->smx_host,
simdata->computation_amount,
simdata->priority);
#ifdef HAVE_TRACING
simdata->comm_amount = communication_amount;
for (i = 0; i < host_nb; i++)
- simdata->host_list[i] = host_list[i]->simdata->smx_host;
+ simdata->host_list[i] = host_list[i]->smx_host;
return task;
}
xbt_assert(simdata->host_nb,
"This is not a parallel task. Go to hell.");
- XBT_DEBUG("Parallel computing on %s", p_simdata->m_host->name);
+ XBT_DEBUG("Parallel computing on %s", SIMIX_host_get_name(p_simdata->m_host->smx_host));
simdata->isused=1;
*
* \param task a #m_task_t to send on another location.
* \param alias name of the mailbox to sent the task to
- * \param match_fun boolean function taking the match_data provided by sender (here), and the one of the receiver (if any) and returning whether they match
+ * \param match_fun boolean function which parameters are:
+ * - match_data_provided_here
+ * - match_data_provided_by_other_side_if_any
+ * - the_smx_action_describing_the_other_side
* \param match_data user provided data passed to match_fun
* \return the msg_comm_t communication created
*/
XBT_INLINE msg_comm_t MSG_task_isend_with_matching(m_task_t task, const char *alias,
- int (*match_fun)(void*,void*),
+ int (*match_fun)(void*,void*, smx_action_t),
void *match_data)
{
simdata_task_t t_simdata = NULL;
*/
/********************************* Host **************************************/
-m_host_t __MSG_host_create(smx_host_t workstation, void *data)
+m_host_t __MSG_host_create(smx_host_t workstation)
{
- const char *name;
- simdata_host_t simdata = xbt_new0(s_simdata_host_t, 1);
+ const char *name = SIMIX_host_get_name(workstation);
m_host_t host = xbt_new0(s_m_host_t, 1);
- name = SIMIX_host_get_name(workstation);
- /* Host structure */
- host->name = xbt_strdup(name);
- host->simdata = simdata;
- host->data = data;
-
- simdata->smx_host = workstation;
+ host->smx_host = workstation;
#ifdef MSG_USE_DEPRECATED
int i;
char alias[MAX_ALIAS_NAME + 1] = { 0 }; /* buffer used to build the key of the mailbox */
if (msg_global->max_channel > 0)
- simdata->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
+ host->mailboxes = xbt_new0(msg_mailbox_t, msg_global->max_channel);
for (i = 0; i < msg_global->max_channel; i++) {
sprintf(alias, "%s:%d", name, i);
/* the key of the mailbox (in this case) is build from the name of the host and the channel number */
- simdata->mailboxes[i] = MSG_mailbox_new(alias);
+ host->mailboxes[i] = MSG_mailbox_new(alias);
memset(alias, 0, MAX_ALIAS_NAME + 1);
}
#endif
*/
MSG_error_t MSG_host_set_data(m_host_t host, void *data)
{
- xbt_assert((host != NULL), "Invalid parameters");
- xbt_assert((host->data == NULL), "Data already set");
-
- /* Assign data */
- host->data = data;
+ SIMIX_host_set_data(host->smx_host,data);
return MSG_OK;
}
void *MSG_host_get_data(m_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters");
-
- /* Return data */
- return (host->data);
+ return SIMIX_host_get_data(host->smx_host);
}
/** \ingroup m_host_management
* This functions checks whether \a host is a valid pointer or not and return
its name.
*/
-const char *MSG_host_get_name(m_host_t host)
-{
-
- xbt_assert((host != NULL)
- && (host->simdata != NULL), "Invalid parameters");
-
- /* Return data */
- return (host->name);
+const char *MSG_host_get_name(m_host_t host) {
+ return SIMIX_host_get_name(host->smx_host);
}
/** \ingroup m_host_management
/** \ingroup m_host_management
*
- * \brief Destroys a host
+ * \brief Destroys a host (internal call only)
*/
-void __MSG_host_destroy(m_host_t host)
-{
- simdata_host_t simdata = NULL;
-
- xbt_assert((host != NULL), "Invalid parameters");
-
- /* Clean simulator data */
- simdata = (host)->simdata;
+void __MSG_host_destroy(m_host_t host) {
#ifdef MSG_USE_DEPRECATED
if (msg_global->max_channel > 0)
- free(simdata->mailboxes);
+ free(host->mailboxes);
#endif
- free(simdata);
-
- /* Clean host structure */
- free(host->name);
free(host);
}
{
xbt_assert((h != NULL), "Invalid parameters");
- return (simcall_host_get_speed(h->simdata->smx_host));
+ return (simcall_host_get_speed(h->smx_host));
}
/** \ingroup m_host_management
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return (simcall_host_get_properties(host->simdata->smx_host));
+ return (simcall_host_get_properties(host->smx_host));
}
int MSG_host_is_avail(m_host_t host)
{
xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return (simcall_host_get_state(host->simdata->smx_host));
+ return (simcall_host_get_state(host->smx_host));
}
m_host_t host)
{
return simcall_rdv_comm_count_by_host(mailbox,
- host->simdata->smx_host);
+ host->smx_host);
}
msg_mailbox_t MSG_mailbox_get_by_alias(const char *alias)
#define MSG_MAILBOX_H
#include "xbt/fifo.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "msg/datatypes.h"
#define METASIMGRID_PRIVATE_H
#include "msg/msg.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "surf/surf.h"
#include "xbt/fifo.h"
#include "xbt/dynar.h"
SG_BEGIN_DECL()
/**************** datatypes **********************************/
-typedef struct simdata_host {
- smx_host_t smx_host; /* SURF modeling */
- msg_mailbox_t *mailboxes; /* mailboxes to store msg tasks of of the host */
-} s_simdata_host_t;
/********************************* Task **************************************/
# define MSG_RETURN(val) return(val)
#endif
-m_host_t __MSG_host_create(smx_host_t workstation, void *data);
+m_host_t __MSG_host_create(smx_host_t workstation);
void __MSG_host_destroy(m_host_t host);
void __MSG_display_process_status(void);
/* Let's create the process: SIMIX may decide to start it right now,
* even before returning the flow control to us */
- simcall_process_create(&process, name, code, simdata, host->name, kill_time,
+ simcall_process_create(&process, name, code, simdata, SIMIX_host_get_name(host->smx_host), kill_time,
argc, argv, properties);
if (!process) {
m_host_t now = simdata->m_host;
TRACE_msg_process_change_host(process, now, host);
#endif
- simcall_process_change_host(process, host->simdata->smx_host);
+ simcall_process_change_host(process, host->smx_host);
return MSG_OK;
}
#include "xbt/function_types.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "simix/context.h"
#include "smx_private.h"
#ifndef _SIMIX_HOST_PRIVATE_H
#define _SIMIX_HOST_PRIVATE_H
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "smx_smurf_private.h"
/** @brief Host datatype */
#ifndef _SIMIX_IO_PRIVATE_H
#define _SIMIX_IO_PRIVATE_H
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "smx_smurf_private.h"
void SIMIX_pre_file_read(smx_simcall_t simcall);
static smx_action_t SIMIX_comm_new(e_smx_comm_type_t type);
static XBT_INLINE void SIMIX_rdv_push(smx_rdv_t rdv, smx_action_t comm);
static smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *), void *);
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *user_data, smx_action_t my_action);
static void SIMIX_rdv_free(void *data);
void SIMIX_network_init(void)
comm->comm.rdv = NULL;
}
-/**
- * \brief Wrapper to SIMIX_rdv_get_comm
- */
-smx_action_t SIMIX_comm_get_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data) {
- return SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data);
-}
-
/**
* \brief Checks if there is a communication action queued in a rendez-vous matching our needs
* \param type The type of communication we are looking for (comm_send, comm_recv)
* \return The communication action if found, NULL otherwise
*/
smx_action_t SIMIX_rdv_get_comm(smx_rdv_t rdv, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *), void *data)
+ int (*match_fun)(void *, void *,smx_action_t),
+ void *this_user_data, smx_action_t my_action)
{
- // FIXME rewrite this function by using SIMIX_rdv_has_send/recv_match
smx_action_t action;
xbt_fifo_item_t item;
- void* comm_data = NULL;
+ void* other_user_data = NULL;
xbt_fifo_foreach(rdv->comm_fifo, item, action, smx_action_t) {
if (action->comm.type == SIMIX_COMM_SEND) {
- comm_data = action->comm.src_data;
+ other_user_data = action->comm.src_data;
} else if (action->comm.type == SIMIX_COMM_RECEIVE) {
- comm_data = action->comm.dst_data;
+ other_user_data = action->comm.dst_data;
}
- if (action->comm.type == type && (!match_fun || match_fun(data, comm_data))) {
+ if (action->comm.type == type &&
+ (!match_fun || match_fun(this_user_data, other_user_data, action)) &&
+ (!action->comm.match_fun || action->comm.match_fun(other_user_data, this_user_data, my_action))) {
XBT_DEBUG("Found a matching communication action %p", action);
xbt_fifo_remove_item(rdv->comm_fifo, item);
xbt_fifo_free_item(item);
return action;
}
XBT_DEBUG("Sorry, communication action %p does not match our needs:"
- " its type is %d but we are looking for a comm of type %d",
+ " its type is %d but we are looking for a comm of type %d (or maybe the filtering didn't match)",
action, (int)action->comm.type, (int)type);
}
XBT_DEBUG("No matching communication action found");
return NULL;
}
-/**
- * \brief Checks if there is a send communication action
- * queued in a rendez-vous matching our needs.
- * \return 1 if found, 0 otherwise
- */
-int SIMIX_comm_has_send_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data) {
-
- smx_action_t action;
- xbt_fifo_item_t item;
-
- xbt_fifo_foreach(rdv->comm_fifo, item, action, smx_action_t){
- if (action->comm.type == SIMIX_COMM_SEND
- && (!match_fun || match_fun(data, action->comm.src_data))) {
- XBT_DEBUG("Found a matching communication action %p", action);
- return 1;
- }
- }
- XBT_DEBUG("No matching communication action found");
- return 0;
-}
-
-/**
- * \brief Checks if there is a recv communication action
- * queued in a rendez-vous matching our needs.
- * \return 1 if found, 0 otherwise
- */
-int SIMIX_comm_has_recv_match(smx_rdv_t rdv, int (*match_fun)(void*, void*), void* data) {
-
- smx_action_t action;
- xbt_fifo_item_t item;
-
- xbt_fifo_foreach(rdv->comm_fifo, item, action, smx_action_t) {
- if (action->comm.type == SIMIX_COMM_RECEIVE
- && (!match_fun || match_fun(data, action->comm.dst_data))) {
- XBT_DEBUG("Found a matching communication action %p", action);
- return 1;
- }
- }
- XBT_DEBUG("No matching communication action found");
- return 0;
-}
/******************************************************************************/
-/* Comunication Actions */
+/* Communication Actions */
/******************************************************************************/
/**
- * \brief Creates a new comunicate action
+ * \brief Creates a new communicate action
* \param type The direction of communication (comm_send, comm_recv)
- * \return The new comunicate action
+ * \return The new communicate action
*/
smx_action_t SIMIX_comm_new(e_smx_comm_type_t type)
{
smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
double task_size, double rate,
void *src_buff, size_t src_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *,smx_action_t),
void (*clean_fun)(void *), // used to free the action in case of problem after a detached send
void *data,
int detached)
{
- smx_action_t action;
+ /* Prepare an action describing us, so that it gets passed to the user-provided filter of other side */
+ smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_SEND);
- /* Look for communication action matching our needs.
- If it is not found then create it and push it into the rendez-vous point */
- action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_RECEIVE, match_fun, data);
+ /* Look for communication action matching our needs. We also provide a description of
+ * 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_action_t other_action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_RECEIVE, match_fun, data, this_action);
- if (!action) {
- action = SIMIX_comm_new(SIMIX_COMM_SEND);
- SIMIX_rdv_push(rdv, action);
+ if (!other_action) {
+ other_action = this_action;
+ SIMIX_rdv_push(rdv, this_action);
} else {
- action->state = SIMIX_READY;
- action->comm.type = SIMIX_COMM_READY;
+ SIMIX_comm_destroy(this_action);
+ --smx_total_comms; // this creation was a pure waste
+
+ other_action->state = SIMIX_READY;
+ other_action->comm.type = SIMIX_COMM_READY;
}
- xbt_fifo_push(src_proc->comms, action);
+ xbt_fifo_push(src_proc->comms, other_action);
/* if the communication action is detached then decrease the refcount
* by one, so it will be eliminated by the receiver's destroy call */
if (detached) {
- action->comm.detached = 1;
- action->comm.refcount--;
- action->comm.clean_fun = clean_fun;
+ other_action->comm.detached = 1;
+ other_action->comm.refcount--;
+ other_action->comm.clean_fun = clean_fun;
} else {
- action->comm.clean_fun = NULL;
+ other_action->comm.clean_fun = NULL;
}
/* Setup the communication action */
- action->comm.src_proc = src_proc;
- action->comm.task_size = task_size;
- action->comm.rate = rate;
- action->comm.src_buff = src_buff;
- action->comm.src_buff_size = src_buff_size;
- action->comm.src_data = data;
+ other_action->comm.src_proc = src_proc;
+ other_action->comm.task_size = task_size;
+ other_action->comm.rate = rate;
+ other_action->comm.src_buff = src_buff;
+ other_action->comm.src_buff_size = src_buff_size;
+ other_action->comm.src_data = data;
+
+ other_action->comm.match_fun = match_fun;
if (MC_IS_ENABLED) {
- action->state = SIMIX_RUNNING;
- return action;
+ other_action->state = SIMIX_RUNNING;
+ return other_action;
}
- SIMIX_comm_start(action);
- return (detached ? NULL : action);
+ SIMIX_comm_start(other_action);
+ return (detached ? NULL : other_action);
}
smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
void *dst_buff, size_t *dst_buff_size,
- int (*match_fun)(void *, void *), void *data)
+ int (*match_fun)(void *, void *, smx_action_t), void *data)
{
- smx_action_t action;
+ /* Prepare an action describing us, so that it gets passed to the user-provided filter of other side */
+ smx_action_t this_action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
- /* Look for communication action matching our needs.
- * If it is not found then create it and push it into the rendez-vous point
- */
- action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data);
+ /* Look for communication action matching our needs. We also provide a description of
+ * 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_action_t other_action = SIMIX_rdv_get_comm(rdv, SIMIX_COMM_SEND, match_fun, data, this_action);
- if (!action) {
- action = SIMIX_comm_new(SIMIX_COMM_RECEIVE);
- SIMIX_rdv_push(rdv, action);
+ if (!other_action) {
+ other_action = this_action;
+ SIMIX_rdv_push(rdv, this_action);
} else {
- action->state = SIMIX_READY;
- action->comm.type = SIMIX_COMM_READY;
+ SIMIX_comm_destroy(this_action);
+ --smx_total_comms; // this creation was a pure waste
+
+ other_action->state = SIMIX_READY;
+ other_action->comm.type = SIMIX_COMM_READY;
}
- xbt_fifo_push(dst_proc->comms, action);
+ xbt_fifo_push(dst_proc->comms, other_action);
/* Setup communication action */
- action->comm.dst_proc = dst_proc;
- action->comm.dst_buff = dst_buff;
- action->comm.dst_buff_size = dst_buff_size;
- action->comm.dst_data = data;
+ other_action->comm.dst_proc = dst_proc;
+ other_action->comm.dst_buff = dst_buff;
+ other_action->comm.dst_buff_size = dst_buff_size;
+ other_action->comm.dst_data = data;
+
+ other_action->comm.match_fun = match_fun;
if (MC_IS_ENABLED) {
- action->state = SIMIX_RUNNING;
- return action;
+ other_action->state = SIMIX_RUNNING;
+ return other_action;
}
- SIMIX_comm_start(action);
- return action;
+ SIMIX_comm_start(other_action);
+ return other_action;
}
void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx)
#ifndef _SIMIX_NETWORK_PRIVATE_H
#define _SIMIX_NETWORK_PRIVATE_H
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "smx_smurf_private.h"
/** @brief Rendez-vous point datatype */
void SIMIX_comm_send(smx_process_t src_proc, smx_rdv_t rdv,
double task_size, double rate,
void *src_buff, size_t src_buff_size,
- int (*)(void *, void *), void *data,
+ int (*match_fun)(void *, void *,smx_action_t), void *data,
double timeout);
smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
double task_size, double rate,
void *src_buff, size_t src_buff_size,
- int (*)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void (*clean_fun)(void *), // used to free the action in case of problem after a detached send
void *data,
int detached);
void SIMIX_comm_recv(smx_process_t dst_proc, smx_rdv_t rdv,
void *dst_buff, size_t *dst_buff_size,
- int (*)(void *, void *), void *data,
+ int (*)(void *, void *,smx_action_t), void *data,
double timeout);
smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
void *dst_buff, size_t *dst_buff_size,
- int (*)(void *, void *), void *data);
+ int (*)(void *, void *, smx_action_t), void *data);
void SIMIX_comm_destroy(smx_action_t action);
void SIMIX_comm_destroy_internal_actions(smx_action_t action);
void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout, int idx);
#ifndef _SIMIX_PRIVATE_H
#define _SIMIX_PRIVATE_H
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "surf/surf.h"
#include "xbt/fifo.h"
#include "xbt/swag.h"
int detached; /* If detached or not */
void (*clean_fun)(void*); /* Function to clean the detached src_buf if something goes wrong */
+ int (*match_fun)(void*,void*,smx_action_t); /* Filter function used by the other side. It is used when
+ looking if a given communication matches my needs. For that, myself must match the
+ expectations of the other side, too. See */
/* Surf action data */
surf_action_t surf_comm; /* The Surf communication action encapsulated */
#ifndef _SIMIX_PROCESS_PRIVATE_H
#define _SIMIX_PROCESS_PRIVATE_H
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "smx_smurf_private.h"
/** @brief Process datatype */
double rate;
void *src_buff;
size_t src_buff_size;
- int (*match_fun)(void *, void *);
+ int (*match_fun)(void *, void *, smx_action_t);
void *data;
double timeout;
} comm_send;
double rate;
void *src_buff;
size_t src_buff_size;
- int (*match_fun)(void *, void *);
+ int (*match_fun)(void *, void *, smx_action_t);
void (*clean_fun)(void *);
void *data;
int detached;
smx_rdv_t rdv;
void *dst_buff;
size_t *dst_buff_size;
- int (*match_fun)(void *, void *);
+ int (*match_fun)(void *, void *, smx_action_t);
void *data;
double timeout;
} comm_recv;
smx_rdv_t rdv;
void *dst_buff;
size_t *dst_buff_size;
- int (*match_fun)(void *, void *);
- void *data;
+ int (*match_fun)(void *, void *, smx_action_t);
+ void *data;
smx_action_t result;
} comm_irecv;
void simcall_comm_send(smx_rdv_t rdv, double task_size, double rate,
void *src_buff, size_t src_buff_size,
- int (*match_fun)(void *, void *), void *data,
+ int (*match_fun)(void *, void *, smx_action_t), void *data,
double timeout)
{
/* checking for infinite values */
smx_action_t simcall_comm_isend(smx_rdv_t rdv, double task_size, double rate,
void *src_buff, size_t src_buff_size,
- int (*match_fun)(void *, void *),
+ int (*match_fun)(void *, void *, smx_action_t),
void (*clean_fun)(void *),
void *data,
int detached)
}
void simcall_comm_recv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
- int (*match_fun)(void *, void *), void *data, double timeout)
+ int (*match_fun)(void *, void *, smx_action_t), void *data, double timeout)
{
xbt_assert(isfinite(timeout), "timeout is not finite!");
xbt_assert(rdv, "No rendez-vous point defined for recv");
}
smx_action_t simcall_comm_irecv(smx_rdv_t rdv, void *dst_buff, size_t * dst_buff_size,
- int (*match_fun)(void *, void *), void *data)
+ int (*match_fun)(void *, void *, smx_action_t), void *data)
{
xbt_assert(rdv, "No rendez-vous point defined for irecv");
#include "xbt.h"
#include "xbt/xbt_os_time.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
#include "smpi/smpi.h"
#include "smpi/smpif.h"
#include "smpi/smpi_cocci.h"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_base, smpi,
"Logging specific to SMPI (base)");
-static int match_recv(void* a, void* b) {
+static int match_recv(void* a, void* b, smx_action_t ignored) {
MPI_Request ref = (MPI_Request)a;
MPI_Request req = (MPI_Request)b;
&& (ref->tag == MPI_ANY_TAG || req->tag == ref->tag);
}
-static int match_send(void* a, void* b) {
+static int match_send(void* a, void* b,smx_action_t ignored) {
MPI_Request ref = (MPI_Request)a;
MPI_Request req = (MPI_Request)b;
#include "xbt/synchro.h" /* This module */
-#include "simix/simix.h" /* used implementation */
-#include "simix/datatypes.h"
+#include "simgrid/simix.h" /* used implementation */
#include "../simix/smx_private.h" /* FIXME */
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt,
* under the terms of the license (GNU LGPL) which comes with this package. */
#include "gras/Virtu/virtu_sg.h"
-#include "simix/simix.h"
+#include "simgrid/simix.h"
/*
* Time elapsed since the begining of the simulation.
#include "xbt/datadesc.h"
#include "xbt/file_stat.h"
#include "../../src/xbt/datadesc/datadesc_private.h" // RAAAAH! ugly relative path, but it's late, I want it to be done NOW.
-#include "simix/datatypes.h"
+#include "simgrid/simix.h"
#include "../../src/simix/smx_smurf_private.h" // RAAAAH! ugly relative path, but it's even later and it still doesn't work
static void define_types(void) {