Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove duplicated code.
[simgrid.git] / src / simix / smx_network_private.h
1 /* Copyright (c) 2007-2010, 2012-2014. The SimGrid Team.
2  * All rights reserved.                                                     */
3
4 /* This program is free software; you can redistribute it and/or modify it
5  * under the terms of the license (GNU LGPL) which comes with this package. */
6
7 #ifndef _SIMIX_NETWORK_PRIVATE_H
8 #define _SIMIX_NETWORK_PRIVATE_H
9
10 #include "simgrid/simix.h"
11 #include "smx_smurf_private.h"
12
13 /** @brief Rendez-vous point datatype */
14 typedef struct s_smx_rvpoint {
15   char *name;
16   xbt_fifo_t comm_fifo;
17   void *data;
18   smx_process_t permanent_receiver; //process which the mailbox is attached to
19   xbt_fifo_t done_comm_fifo;//messages already received in the permanent receive mode
20 } s_smx_rvpoint_t;
21
22 void SIMIX_network_init(void);
23 void SIMIX_network_exit(void);
24
25 #ifdef HAVE_LATENCY_BOUND_TRACKING
26 XBT_INLINE XBT_PUBLIC(int) SIMIX_comm_is_latency_bounded(smx_action_t comm);
27 #endif
28
29 smx_rdv_t SIMIX_rdv_create(const char *name);
30 void SIMIX_rdv_destroy(smx_rdv_t rdv);
31 smx_rdv_t SIMIX_rdv_get_by_name(const char *name);
32 void SIMIX_rdv_remove(smx_rdv_t rdv, smx_action_t comm);
33 int SIMIX_rdv_comm_count_by_host(smx_rdv_t rdv, smx_host_t host);
34 smx_action_t SIMIX_rdv_get_head(smx_rdv_t rdv);
35 void SIMIX_rdv_set_receiver(smx_rdv_t rdv, smx_process_t proc);
36 smx_process_t SIMIX_rdv_get_receiver(smx_rdv_t rdv);
37 smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
38                               double task_size, double rate,
39                               void *src_buff, size_t src_buff_size,
40                               int (*match_fun)(void *, void *, smx_action_t),
41                               void (*clean_fun)(void *), // used to free the action in case of problem after a detached send
42                               void *data,
43                               int detached);
44 smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
45                               void *dst_buff, size_t *dst_buff_size,
46                               int (*)(void *, void *, smx_action_t),
47                               void *data, double rate);
48 void SIMIX_comm_destroy(smx_action_t action);
49 void SIMIX_comm_destroy_internal_actions(smx_action_t action);
50 smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
51                               int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
52 void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
53 void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
54 void SIMIX_post_comm(smx_action_t action);
55 void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action);
56 void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions);
57 void SIMIX_comm_cancel(smx_action_t action);
58 double SIMIX_comm_get_remains(smx_action_t action);
59 e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
60 void SIMIX_comm_suspend(smx_action_t action);
61 void SIMIX_comm_resume(smx_action_t action);
62 smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
63 smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
64
65 // pre prototypes
66 smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
67                                    int src, int tag,
68                                    int (*match_fun)(void *, void *, smx_action_t),
69                                    void *data);
70 smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
71 void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv);
72 smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name);
73 int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host);
74 smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv);
75 smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv);
76 void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
77                             smx_process_t process);
78 void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
79                                   double task_size, double rate,
80                                   void *src_buff, size_t src_buff_size,
81                                   int (*match_fun)(void *, void *,smx_action_t),
82                                   void *data, double timeout);
83 smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
84                                   double task_size, double rate,
85                                   void *src_buff, size_t src_buff_size,
86                                   int (*match_fun)(void *, void *,smx_action_t),
87                                   void (*clean_fun)(void *), 
88                                   void *data, int detached);
89 void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
90                          void *dst_buff, size_t *dst_buff_size,
91                          int (*match_fun)(void *, void *, smx_action_t),
92                          void *data, double timeout, double rate);
93 smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
94                                   void *dst_buff, size_t *dst_buff_size,
95                                   int (*match_fun)(void *, void *, smx_action_t),
96                                   void *data, double rate);
97 void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action);
98 void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action);
99 double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action);
100 e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action);
101 void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action);
102 void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action);
103 smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action);
104 smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action);
105 #ifdef HAVE_LATENCY_BOUND_TRACKING
106 int SIMIX_pre_comm_is_latency_bounded(smx_simcall_t simcall, smx_action_t action);
107 #endif
108 #endif
109