1 #ifndef SIMDAG_SIMDAG_H
2 #define SIMDAG_SIMDAG_H
4 #include "simdag/datatypes.h"
9 /************************** Link handling ***********************************/
11 /** @defgroup SD_link_management Links
12 * @brief Functions for managing the network links
14 * This section describes the functions for managing the network links.
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.
23 XBT_PUBLIC const SD_link_t* SD_link_get_list(void);
24 XBT_PUBLIC int SD_link_get_number(void);
25 XBT_PUBLIC void* SD_link_get_data(SD_link_t link);
26 XBT_PUBLIC void SD_link_set_data(SD_link_t link, void *data);
27 XBT_PUBLIC const char* SD_link_get_name(SD_link_t link);
28 XBT_PUBLIC double SD_link_get_current_bandwidth(SD_link_t link);
29 XBT_PUBLIC double SD_link_get_current_latency(SD_link_t link);
32 /************************** Workstation handling ****************************/
34 /** @defgroup SD_workstation_management Workstations
35 * @brief Functions for managing the workstations
37 * This section describes the functions for managing the workstations.
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>.
43 * The workstations are created when you call the function SD_create_environment.
45 * @see SD_workstation_t
48 XBT_PUBLIC SD_workstation_t SD_workstation_get_by_name(const char *name);
49 XBT_PUBLIC const SD_workstation_t* SD_workstation_get_list(void);
50 XBT_PUBLIC int SD_workstation_get_number(void);
51 XBT_PUBLIC void SD_workstation_set_data(SD_workstation_t workstation, void *data);
52 XBT_PUBLIC void* SD_workstation_get_data(SD_workstation_t workstation);
53 XBT_PUBLIC const char* SD_workstation_get_name(SD_workstation_t workstation);
54 XBT_PUBLIC const SD_link_t* SD_route_get_list(SD_workstation_t src, SD_workstation_t dst);
55 XBT_PUBLIC int SD_route_get_size(SD_workstation_t src, SD_workstation_t dst);
56 XBT_PUBLIC double SD_workstation_get_power(SD_workstation_t workstation);
57 XBT_PUBLIC double SD_workstation_get_available_power(SD_workstation_t workstation);
58 XBT_PUBLIC e_SD_workstation_access_mode_t SD_workstation_get_access_mode(SD_workstation_t workstation);
59 XBT_PUBLIC void SD_workstation_set_access_mode(SD_workstation_t workstation,
60 e_SD_workstation_access_mode_t access_mode);
62 XBT_PUBLIC double SD_workstation_get_computation_time(SD_workstation_t workstation, double computation_amount);
63 XBT_PUBLIC double SD_route_get_current_latency(SD_workstation_t src, SD_workstation_t dst);
64 XBT_PUBLIC double SD_route_get_current_bandwidth(SD_workstation_t src, SD_workstation_t dst);
65 XBT_PUBLIC double SD_route_get_communication_time(SD_workstation_t src, SD_workstation_t dst,
66 double communication_amount);
70 /************************** Task handling ************************************/
72 /** @defgroup SD_task_management Tasks
73 * @brief Functions for managing the tasks
75 * This section describes the functions for managing the tasks.
77 * A task is some <em>working amount</em> that can be executed
78 * in parallel on several workstations. A task may depend on other
79 * tasks, this means that the task cannot start until the other tasks are done.
80 * Each task has a <em>\ref e_SD_task_state_t "state"</em> indicating whether
81 * the task is scheduled, running, done, etc.
83 * @see SD_task_t, SD_task_dependency_management
86 XBT_PUBLIC SD_task_t SD_task_create(const char *name, void *data, double amount);
87 XBT_PUBLIC void* SD_task_get_data(SD_task_t task);
88 XBT_PUBLIC void SD_task_set_data(SD_task_t task, void *data);
89 XBT_PUBLIC e_SD_task_state_t SD_task_get_state(SD_task_t task);
90 XBT_PUBLIC const char* SD_task_get_name(SD_task_t task);
91 XBT_PUBLIC void SD_task_watch(SD_task_t task, e_SD_task_state_t state);
92 XBT_PUBLIC void SD_task_unwatch(SD_task_t task, e_SD_task_state_t state);
93 XBT_PUBLIC double SD_task_get_amount(SD_task_t task);
94 XBT_PUBLIC double SD_task_get_remaining_amount(SD_task_t task);
95 XBT_PUBLIC double SD_task_get_execution_time(SD_task_t task, int workstation_nb,
96 const SD_workstation_t *workstation_list,
97 const double *computation_amount, const double *communication_amount,
99 XBT_PUBLIC void SD_task_schedule(SD_task_t task, int workstation_nb,
100 const SD_workstation_t *workstation_list, const double *computation_amount,
101 const double *communication_amount, double rate);
102 XBT_PUBLIC void SD_task_unschedule(SD_task_t task);
103 XBT_PUBLIC double SD_task_get_start_time(SD_task_t task);
104 XBT_PUBLIC double SD_task_get_finish_time(SD_task_t task);
105 XBT_PUBLIC void SD_task_destroy(SD_task_t task);
109 /** @defgroup SD_task_dependency_management Tasks dependencies
110 * @brief Functions for managing the task dependencies
112 * This section describes the functions for managing the dependencies between the tasks.
114 * @see SD_task_management
117 XBT_PUBLIC void SD_task_dependency_add(const char *name, void *data, SD_task_t src, SD_task_t dst);
118 XBT_PUBLIC void SD_task_dependency_remove(SD_task_t src, SD_task_t dst);
119 XBT_PUBLIC void* SD_task_dependency_get_data(SD_task_t src, SD_task_t dst);
122 /************************** Global *******************************************/
124 /** @defgroup SD_simulation Simulation
125 * @brief Functions for creating the environment and launching the simulation
127 * This section describes the functions for initialising SimDag, launching
128 * the simulation and exiting SimDag.
132 XBT_PUBLIC void SD_init(int *argc, char **argv);
133 XBT_PUBLIC void SD_create_environment(const char *platform_file);
134 XBT_PUBLIC SD_task_t* SD_simulate(double how_long);
135 XBT_PUBLIC double SD_get_clock(void);
136 XBT_PUBLIC void SD_exit(void);