Logo AND Algorithmique Numérique Distribuée

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