Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill the useless 'rate' argument of SD_task_get_execution_time()
[simgrid.git] / include / simdag / simdag.h
1 #ifndef SIMDAG_SIMDAG_H
2 #define SIMDAG_SIMDAG_H
3
4 #include "simdag/datatypes.h"
5 #include "xbt/misc.h"
6 #include "xbt/dynar.h"
7 #include "xbt/dict.h"
8
9
10 SG_BEGIN_DECL()
11
12 /************************** Link handling ***********************************/
13 /** @defgroup SD_link_management Links
14  *  @brief Functions for managing the network links
15  *
16  *  This section describes the functions for managing the network links.
17  *
18  *  A link is a network node represented as a <em>name</em>, a <em>current
19  *  bandwidth</em> and a <em>current latency</em>. The links are created
20  *  when you call the function SD_create_environment.
21  *
22  *  @see SD_link_t
23  *  @{
24  */
25 XBT_PUBLIC(const SD_link_t *) SD_link_get_list(void);
26 XBT_PUBLIC(int) SD_link_get_number(void);
27 XBT_PUBLIC(void *) SD_link_get_data(SD_link_t link);
28 XBT_PUBLIC(void) SD_link_set_data(SD_link_t link, void *data);
29 XBT_PUBLIC(const char *) SD_link_get_name(SD_link_t link);
30 XBT_PUBLIC(double) SD_link_get_current_bandwidth(SD_link_t link);
31 XBT_PUBLIC(double) SD_link_get_current_latency(SD_link_t link);
32 XBT_PUBLIC(e_SD_link_sharing_policy_t) SD_link_get_sharing_policy(SD_link_t
33                                                                   link);
34 /** @} */
35
36 /************************** Workstation handling ****************************/
37
38 /** @defgroup SD_workstation_management Workstations
39  *  @brief Functions for managing the workstations
40  *
41  *  This section describes the functions for managing the workstations.
42  *
43  *  A workstation is a place where a task can be executed.
44  *  A workstation is represented as a <em>physical
45  *  resource with computing capabilities</em> and has a <em>name</em>.
46  *
47  *  The workstations are created when you call the function SD_create_environment.
48  *
49  *  @see SD_workstation_t
50  *  @{
51  */
52 XBT_PUBLIC(SD_workstation_t) SD_workstation_get_by_name(const char *name);
53 XBT_PUBLIC(const SD_workstation_t *) SD_workstation_get_list(void);
54 XBT_PUBLIC(int) SD_workstation_get_number(void);
55 XBT_PUBLIC(void) SD_workstation_set_data(SD_workstation_t workstation,
56                                          void *data);
57 XBT_PUBLIC(void *) SD_workstation_get_data(SD_workstation_t workstation);
58 XBT_PUBLIC(const char *) SD_workstation_get_name(SD_workstation_t
59                                                  workstation);
60 /*property handling functions*/
61 XBT_PUBLIC(xbt_dict_t) SD_workstation_get_properties(SD_workstation_t
62                                                      workstation);
63 XBT_PUBLIC(const char *) SD_workstation_get_property_value(SD_workstation_t
64                                                            workstation,
65                                                            const char *name);
66
67 XBT_PUBLIC(const SD_link_t *) SD_route_get_list(SD_workstation_t src,
68                                                 SD_workstation_t dst);
69 XBT_PUBLIC(int) SD_route_get_size(SD_workstation_t src, SD_workstation_t dst);
70 XBT_PUBLIC(double) SD_workstation_get_power(SD_workstation_t workstation);
71 XBT_PUBLIC(double) SD_workstation_get_available_power(SD_workstation_t
72                                                       workstation);
73 XBT_PUBLIC(e_SD_workstation_access_mode_t)
74   SD_workstation_get_access_mode(SD_workstation_t workstation);
75 XBT_PUBLIC(void) SD_workstation_set_access_mode(SD_workstation_t workstation,
76                                                 e_SD_workstation_access_mode_t
77                                                 access_mode);
78
79 XBT_PUBLIC(double) SD_workstation_get_computation_time(SD_workstation_t
80                                                        workstation,
81                                                        double
82                                                        computation_amount);
83 XBT_PUBLIC(double) SD_route_get_current_latency(SD_workstation_t src,
84                                                 SD_workstation_t dst);
85 XBT_PUBLIC(double) SD_route_get_current_bandwidth(SD_workstation_t src,
86                                                   SD_workstation_t dst);
87 XBT_PUBLIC(double) SD_route_get_communication_time(SD_workstation_t src,
88                                                    SD_workstation_t dst,
89                                                    double
90                                                    communication_amount);
91
92 /** @} */
93
94 /************************** Task handling ************************************/
95
96 /** @defgroup SD_task_management Tasks
97  *  @brief Functions for managing the tasks
98  *
99  *  This section describes the functions for managing the tasks.
100  *
101  *  A task is some <em>working amount</em> that can be executed
102  *  in parallel on several workstations. A task may depend on other
103  *  tasks, this means that the task cannot start until the other tasks are done.
104  *  Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether
105  *  the task is scheduled, running, done, etc.
106  *
107  *  @see SD_task_t, SD_task_dependency_management
108  *  @{
109  */
110 XBT_PUBLIC(SD_task_t) SD_task_create(const char *name, void *data,
111                                      double amount);
112 XBT_PUBLIC(void *) SD_task_get_data(SD_task_t task);
113 XBT_PUBLIC(void) SD_task_set_data(SD_task_t task, void *data);
114 XBT_PUBLIC(e_SD_task_state_t) SD_task_get_state(SD_task_t task);
115 XBT_PUBLIC(const char *) SD_task_get_name(SD_task_t task);
116 XBT_PUBLIC(void) SD_task_watch(SD_task_t task, e_SD_task_state_t state);
117 XBT_PUBLIC(void) SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
118 XBT_PUBLIC(double) SD_task_get_amount(SD_task_t task);
119 XBT_PUBLIC(double) SD_task_get_remaining_amount(SD_task_t task);
120 XBT_PUBLIC(double) SD_task_get_execution_time(SD_task_t task,
121                                               int workstation_nb,
122                                               const SD_workstation_t *
123                                               workstation_list, const double
124                                               *computation_amount, const double
125                                               *communication_amount);
126 XBT_PUBLIC(int) SD_task_get_kind(SD_task_t task);
127 XBT_PUBLIC(void) SD_task_schedule(SD_task_t task, int workstation_nb,
128                                   const SD_workstation_t * workstation_list,
129                                   const double *computation_amount,
130                                   const double *communication_amount,
131                                   double rate);
132 XBT_PUBLIC(void) SD_task_unschedule(SD_task_t task);
133 XBT_PUBLIC(double) SD_task_get_start_time(SD_task_t task);
134 XBT_PUBLIC(double) SD_task_get_finish_time(SD_task_t task);
135 XBT_PUBLIC(xbt_dynar_t) SD_task_get_parents(SD_task_t task);
136 XBT_PUBLIC(xbt_dynar_t) SD_task_get_children(SD_task_t task);
137 XBT_PUBLIC(int) SD_task_get_workstation_count(SD_task_t task);
138 XBT_PUBLIC(SD_workstation_t*) SD_task_get_workstation_list(SD_task_t task);
139 XBT_PUBLIC(void) SD_task_destroy(SD_task_t task);
140 XBT_PUBLIC(void) SD_task_dump(SD_task_t task);
141 XBT_PUBLIC(void) SD_task_dotty(SD_task_t task,void* out_FILE);
142
143 XBT_PUBLIC(SD_task_t) SD_task_create_comp_seq(const char*name,void *data,double amount);
144 XBT_PUBLIC(SD_task_t) SD_task_create_comm_e2e(const char*name,void *data,double amount);
145 XBT_PUBLIC(void) SD_task_schedulev(SD_task_t task, int count, const SD_workstation_t*list);
146 XBT_PUBLIC(void) SD_task_schedulel(SD_task_t task, int count, ...);
147
148 /** @} */
149
150
151 /** @defgroup SD_task_dependency_management Tasks dependencies
152  *  @brief Functions for managing the task dependencies
153  *
154  *  This section describes the functions for managing the dependencies between the tasks.
155  *
156  *  @see SD_task_management
157  *  @{
158  */
159 XBT_PUBLIC(void) SD_task_dependency_add(const char *name, void *data,
160                                         SD_task_t src, SD_task_t dst);
161 XBT_PUBLIC(void) SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
162 XBT_PUBLIC(void *) SD_task_dependency_get_data(SD_task_t src, SD_task_t dst);
163 XBT_PUBLIC(int) SD_task_dependency_exists(SD_task_t src, SD_task_t dst);
164 /** @} */
165
166 /************************** Global *******************************************/
167
168 /** @defgroup SD_simulation Simulation
169  *  @brief Functions for creating the environment and launching the simulation
170  *
171  *  This section describes the functions for initialising SimDag, launching
172  *  the simulation and exiting SimDag.
173  *
174  *  @{
175  */
176 XBT_PUBLIC(void) SD_init(int *argc, char **argv);
177 XBT_PUBLIC(void) SD_application_reinit(void);
178 XBT_PUBLIC(void) SD_create_environment(const char *platform_file);
179 XBT_PUBLIC(SD_task_t *) SD_simulate(double how_long);
180 XBT_PUBLIC(double) SD_get_clock(void);
181 XBT_PUBLIC(void) SD_exit(void);
182 XBT_PUBLIC(xbt_dynar_t) SD_daxload(const char*filename);
183
184 /** @} */
185
186 SG_END_DECL()
187 #endif