Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
some of the action checking code didn't work right, so I removed it.
[simgrid.git] / src / smpi / private.h
index 804ea9e..69d63f5 100644 (file)
@@ -44,13 +44,15 @@ typedef struct smpi_mpi_request_t {
 
        smx_mutex_t mutex;
        smx_cond_t  cond;
+
+       void *data;
+       int forward;
+
 } s_smpi_mpi_request_t;
 
 // smpi mpi op
-// FIXME: type should be (void *a, void *b, int *length, MPI_Datatype *datatype)
-//, oper is b[i] = a[i] op b[i]
 typedef struct smpi_mpi_op_t {
-  void (*func)(void *x, void *y, void *z);
+  void (*func)(void *a, void *b, int *length, MPI_Datatype *datatype);
 } s_smpi_mpi_op_t;
 
 // smpi received message
@@ -60,9 +62,21 @@ typedef struct smpi_received_message_t {
        int tag;
 
        void *buf;
+
+       void *data;
+       int forward;
+
 } s_smpi_received_message_t;
 typedef struct smpi_received_message_t *smpi_received_message_t;
 
+typedef struct smpi_do_once_duration_node_t {
+       char *file;
+       int line;
+       double duration;
+       struct smpi_do_once_duration_node_t *next;
+} s_smpi_do_once_duration_node_t;
+typedef struct smpi_do_once_duration_node_t *smpi_do_once_duration_node_t;
+
 typedef struct smpi_global_t {
 
        // config vars
@@ -79,6 +93,7 @@ typedef struct smpi_global_t {
        xbt_mallocator_t  request_mallocator;
        xbt_mallocator_t  message_mallocator;
 
+       // FIXME: request queues should be moved to host data...
        xbt_fifo_t       *pending_send_request_queues;
        smx_mutex_t      *pending_send_request_queues_mutexes;
 
@@ -94,30 +109,49 @@ typedef struct smpi_global_t {
        int               running_hosts_count;
        smx_mutex_t       running_hosts_count_mutex;
 
-       xbt_os_timer_t   *timers;
-       smx_mutex_t      *timers_mutexes;
+       xbt_os_timer_t    timer;
+       smx_mutex_t       timer_mutex;
+       smx_cond_t        timer_cond;
+
+       // keeps track of previous times
+       smpi_do_once_duration_node_t do_once_duration_nodes;
+       smx_mutex_t do_once_mutex;
+       double *do_once_duration;
 
 } s_smpi_global_t;
 typedef struct smpi_global_t *smpi_global_t;
 extern smpi_global_t smpi_global;
 
+typedef struct smpi_host_data_t {
+       int index;
+       smx_mutex_t mutex;
+       smx_cond_t cond;
+} s_smpi_host_data_t;
+typedef struct smpi_host_data_t *smpi_host_data_t;
+
 // function prototypes
 void smpi_mpi_init(void);
 void smpi_mpi_finalize(void);
-int smpi_mpi_comm_size(smpi_mpi_communicator_t comm, int *size);
-int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm, int *rank);
+int smpi_mpi_comm_rank(smpi_mpi_communicator_t comm);
+
 int smpi_mpi_barrier(smpi_mpi_communicator_t comm);
 int smpi_mpi_isend(smpi_mpi_request_t request);
 int smpi_mpi_irecv(smpi_mpi_request_t request);
 int smpi_mpi_wait(smpi_mpi_request_t request, smpi_mpi_status_t *status);
 
+void smpi_execute(double duration);
+void smpi_start_timer(void);
+double smpi_stop_timer(void);
 void smpi_bench_begin(void);
 void smpi_bench_end(void);
+void smpi_bench_skip(void);
 
 void smpi_global_init(void);
 void smpi_global_destroy(void);
 int smpi_host_index(void);
-int smpi_run_simulation(int argc, char **argv);
+smx_mutex_t smpi_host_mutex(void);
+smx_cond_t smpi_host_cond(void);
+int smpi_run_simulation(int *argc, char **argv);
 int smpi_create_request(void *buf, int count, smpi_mpi_datatype_t datatype,
        int src, int dst, int tag, smpi_mpi_communicator_t comm, smpi_mpi_request_t *request);