1 /* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
2 * All rights reserved. */
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. */
7 #ifndef _SIMIX_NETWORK_PRIVATE_H
8 #define _SIMIX_NETWORK_PRIVATE_H
10 #include "simgrid/simix.h"
11 #include "smx_smurf_private.h"
13 /** @brief Rendez-vous point datatype */
14 typedef struct s_smx_rvpoint {
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
22 void SIMIX_network_init(void);
23 void SIMIX_network_exit(void);
25 #ifdef HAVE_LATENCY_BOUND_TRACKING
26 XBT_INLINE XBT_PUBLIC(int) SIMIX_comm_is_latency_bounded(smx_action_t comm);
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 void SIMIX_comm_start(smx_action_t action);
38 void SIMIX_comm_send(smx_process_t src_proc, smx_rdv_t rdv,
39 double task_size, double rate,
40 void *src_buff, size_t src_buff_size,
41 int (*match_fun)(void *, void *,smx_action_t), void *data,
43 smx_action_t SIMIX_comm_isend(smx_process_t src_proc, smx_rdv_t rdv,
44 double task_size, double rate,
45 void *src_buff, size_t src_buff_size,
46 int (*match_fun)(void *, void *, smx_action_t),
47 void (*clean_fun)(void *), // used to free the action in case of problem after a detached send
50 void SIMIX_comm_recv(smx_process_t dst_proc, smx_rdv_t rdv,
51 void *dst_buff, size_t *dst_buff_size,
52 int (*)(void *, void *,smx_action_t), void *data,
54 smx_action_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_rdv_t rdv,
55 void *dst_buff, size_t *dst_buff_size,
56 int (*)(void *, void *, smx_action_t), void *data);
57 void SIMIX_comm_recv_bounded(smx_process_t dst_proc, smx_rdv_t rdv,
58 void *dst_buff, size_t *dst_buff_size,
59 int (*)(void *, void *,smx_action_t), void *data,
60 double timeout, double rate);
61 smx_action_t SIMIX_comm_irecv_bounded(smx_process_t dst_proc, smx_rdv_t rdv,
62 void *dst_buff, size_t *dst_buff_size,
63 int (*)(void *, void *, smx_action_t), void *data, double rate);
64 void SIMIX_comm_destroy(smx_action_t action);
65 void SIMIX_comm_destroy_internal_actions(smx_action_t action);
66 smx_action_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_rdv_t rdv, int src,
67 int tag, int (*match_fun)(void *, void *, smx_action_t), void *data);
68 void SIMIX_pre_comm_wait(smx_simcall_t simcall, smx_action_t action, double timeout);
69 void SIMIX_pre_comm_waitany(smx_simcall_t simcall, xbt_dynar_t actions);
70 void SIMIX_post_comm(smx_action_t action);
71 void SIMIX_pre_comm_test(smx_simcall_t simcall, smx_action_t action);
72 void SIMIX_pre_comm_testany(smx_simcall_t simcall, xbt_dynar_t actions);
73 void SIMIX_comm_cancel(smx_action_t action);
74 double SIMIX_comm_get_remains(smx_action_t action);
75 e_smx_state_t SIMIX_comm_get_state(smx_action_t action);
76 void SIMIX_comm_suspend(smx_action_t action);
77 void SIMIX_comm_resume(smx_action_t action);
78 smx_process_t SIMIX_comm_get_src_proc(smx_action_t action);
79 smx_process_t SIMIX_comm_get_dst_proc(smx_action_t action);
82 smx_action_t SIMIX_pre_comm_iprobe(smx_simcall_t simcall, smx_rdv_t rdv,
84 int (*match_fun)(void *, void *, smx_action_t),
86 smx_rdv_t SIMIX_pre_rdv_create(smx_simcall_t simcall, const char *name);
87 void SIMIX_pre_rdv_destroy(smx_simcall_t simcall, smx_rdv_t rdv);
88 smx_rdv_t SIMIX_pre_rdv_get_by_name(smx_simcall_t simcall, const char *name);
89 int SIMIX_pre_rdv_comm_count_by_host(smx_simcall_t simcall, smx_rdv_t rdv, smx_host_t host);
90 smx_action_t SIMIX_pre_rdv_get_head(smx_simcall_t simcall, smx_rdv_t rdv);
91 smx_process_t SIMIX_pre_rdv_get_receiver(smx_simcall_t simcall, smx_rdv_t rdv);
92 void SIMIX_pre_rdv_set_receiver(smx_simcall_t simcall, smx_rdv_t rdv,
93 smx_process_t process);
94 void SIMIX_pre_comm_send(smx_simcall_t simcall, smx_rdv_t rdv,
95 double task_size, double rate,
96 void *src_buff, size_t src_buff_size,
97 int (*match_fun)(void *, void *,smx_action_t),
98 void *data, double timeout);
99 smx_action_t SIMIX_pre_comm_isend(smx_simcall_t simcall, smx_rdv_t rdv,
100 double task_size, double rate,
101 void *src_buff, size_t src_buff_size,
102 int (*match_fun)(void *, void *,smx_action_t),
103 void (*clean_fun)(void *),
104 void *data, int detached);
105 void SIMIX_pre_comm_recv(smx_simcall_t simcall, smx_rdv_t rdv,
106 void *dst_buff, size_t *dst_buff_size,
107 int (*match_fun)(void *, void *, smx_action_t),
108 void *data, double timeout);
109 void SIMIX_pre_comm_recv_bounded(smx_simcall_t simcall, smx_rdv_t rdv,
110 void *dst_buff, size_t *dst_buff_size,
111 int (*match_fun)(void *, void *, smx_action_t),
112 void *data, double timeout, double rate);
113 smx_action_t SIMIX_pre_comm_irecv(smx_simcall_t simcall, smx_rdv_t rdv,
114 void *dst_buff, size_t *dst_buff_size,
115 int (*match_fun)(void *, void *, smx_action_t),
117 smx_action_t SIMIX_pre_comm_irecv_bounded(smx_simcall_t simcall, smx_rdv_t rdv,
118 void *dst_buff, size_t *dst_buff_size,
119 int (*match_fun)(void *, void *, smx_action_t),
120 void *data, double rate);
121 void SIMIX_pre_comm_destroy(smx_simcall_t simcall, smx_action_t action);
122 void SIMIX_pre_comm_cancel(smx_simcall_t simcall, smx_action_t action);
123 double SIMIX_pre_comm_get_remains(smx_simcall_t simcall, smx_action_t action);
124 e_smx_state_t SIMIX_pre_comm_get_state(smx_simcall_t simcall, smx_action_t action);
125 void* SIMIX_pre_comm_get_src_data(smx_simcall_t simcall, smx_action_t action);
126 void* SIMIX_pre_comm_get_dst_data(smx_simcall_t simcall, smx_action_t action);
127 smx_process_t SIMIX_pre_comm_get_src_proc(smx_simcall_t simcall, smx_action_t action);
128 smx_process_t SIMIX_pre_comm_get_dst_proc(smx_simcall_t simcall, smx_action_t action);