Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
1c2f004151b673b91aeb4787aad83a0d152a8557
[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
7 SG_BEGIN_DECL()
8
9 /************************** Link handling ***********************************/
10
11 /** @defgroup SD_link_management Links
12  *  @brief Functions for managing the network links
13  * 
14  *  This section describes the functions for managing the network links.
15  *  
16  *  A link is a network node represented as a <em>name</em>, a <em>current
17  *  bandwidth</em> and a <em>current latency</em>. The links are created
18  *  when you call the function SD_create_environment.
19  *
20  *  @see SD_link_t
21  *  @{
22  */
23 const SD_link_t*   SD_link_get_list(void);
24 int                SD_link_get_number(void);
25 void*              SD_link_get_data(SD_link_t link);
26 void               SD_link_set_data(SD_link_t link, void *data);
27 const char*        SD_link_get_name(SD_link_t link);
28 double             SD_link_get_current_bandwidth(SD_link_t link);
29 double             SD_link_get_current_latency(SD_link_t link);
30 /** @} */
31
32 /************************** Workstation handling ****************************/
33
34 /** @defgroup SD_workstation_management Workstations
35  *  @brief Functions for managing the workstations
36  * 
37  *  This section describes the functions for managing the workstations.
38  *  
39  *  A workstation is a place where a task can be executed.
40  *  A workstation is represented as a <em>physical
41  *  resource with computing capabilities</em> and has a <em>name</em>.
42  *
43  *  The workstations are created when you call the function SD_create_environment.
44  *
45  *  @see SD_workstation_t
46  *  @{
47  */
48 SD_workstation_t        SD_workstation_get_by_name(const char *name);
49 const SD_workstation_t* SD_workstation_get_list(void);
50 int                     SD_workstation_get_number(void);
51 void                    SD_workstation_set_data(SD_workstation_t workstation, void *data);
52 void*                   SD_workstation_get_data(SD_workstation_t workstation);
53 const char*             SD_workstation_get_name(SD_workstation_t workstation);
54 SD_link_t*              SD_workstation_route_get_list(SD_workstation_t src, SD_workstation_t dst);
55 int                     SD_workstation_route_get_size(SD_workstation_t src, SD_workstation_t dst);
56 double                  SD_workstation_get_power(SD_workstation_t workstation);
57 double                  SD_workstation_get_available_power(SD_workstation_t workstation);
58 /** @} */
59
60 /************************** Task handling ************************************/
61
62 /** @defgroup SD_task_management Tasks
63  *  @brief Functions for managing the tasks
64  * 
65  *  This section describes the functions for managing the tasks.
66  *  
67  *  A task is some <em>working amount</em> that can be executed
68  *  in parallel on several workstations. A task may depend on other
69  *  tasks, this means that the task cannot start until the other tasks are done.
70  *  Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether
71  *  the task is scheduled, running, done, etc.
72  *  
73  *  @see SD_task_t, SD_task_dependency_management
74  *  @{
75  */
76 SD_task_t         SD_task_create(const char *name, void *data, double amount);
77 void*             SD_task_get_data(SD_task_t task);
78 void              SD_task_set_data(SD_task_t task, void *data);
79 e_SD_task_state_t SD_task_get_state(SD_task_t task);
80 const char*       SD_task_get_name(SD_task_t task);
81 double            SD_task_get_amount(SD_task_t task);
82 double            SD_task_get_remaining_amount(SD_task_t task);
83 void              SD_task_watch(SD_task_t task, e_SD_task_state_t state);
84 void              SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
85 void              SD_task_schedule(SD_task_t task, int workstation_nb,
86                                    const SD_workstation_t *workstation_list, const double *computation_amount,
87                                    const double *communication_amount, double rate);
88 void              SD_task_unschedule(SD_task_t task);
89 void              SD_task_destroy(SD_task_t task);
90 /** @} */
91
92
93 /** @defgroup SD_task_dependency_management Tasks dependencies
94  *  @brief Functions for managing the task dependencies
95  *
96  *  This section describes the functions for managing the dependencies between the tasks.
97  *
98  *  @see SD_task_management
99  *  @{
100  */
101 void              SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst);
102 void              SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
103 void*             SD_task_dependency_get_data(SD_task_t src, SD_task_t dst);
104 /** @} */
105
106 /************************** Global *******************************************/
107
108 /** @defgroup SD_simulation Simulation
109  *  @brief Functions for creating the environment and launching the simulation
110  * 
111  *  This section describes the functions for initialising SimDag, launching
112  *  the simulation and exiting SimDag.
113  *  
114  *  @{
115  */
116 void              SD_init(int *argc, char **argv);
117 void              SD_create_environment(const char *platform_file);
118 SD_task_t*        SD_simulate(double how_long);
119 void              SD_exit(void);
120 /** @} */
121
122 SG_END_DECL()
123
124 #endif