1 /* Copyright (c) 2006-2015. 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 SIMDAG_PRIVATE_H
8 #define SIMDAG_PRIVATE_H
11 #include "xbt/dynar.h"
12 #include "simgrid/simdag.h"
13 #include "surf/surf.h"
14 #include "xbt/mallocator.h"
17 #include "simgrid/jedule/jedule_sd_binding.h"
22 /* Global variables */
24 typedef struct SD_global {
25 xbt_mallocator_t task_mallocator; /* to not remalloc new tasks */
27 bool watch_point_reached; /* has a task just reached a watch point? */
29 std::set<SD_task_t> *initial_tasks;
30 std::set<SD_task_t> *runnable_tasks;
31 std::set<SD_task_t> *completed_tasks;
33 xbt_dynar_t return_set;
35 } s_SD_global_t, *SD_global_t;
37 extern XBT_PRIVATE SD_global_t sd_global;
40 typedef struct SD_task {
41 e_SD_task_state_t state;
42 void *data; /* user data */
44 e_SD_task_kind_t kind;
46 double alpha; /* used by typed parallel tasks */
50 surf_action_t surf_action;
51 unsigned short watch_points; /* bit field xor()ed with masks */
53 int marked; /* used to check if the task DAG has some cycle*/
56 std::set<SD_task_t> *inputs;
57 std::set<SD_task_t> *outputs;
58 std::set<SD_task_t> *predecessors;
59 std::set<SD_task_t> *successors;
61 /* scheduling parameters (only exist in state SD_SCHEDULED) */
62 std::vector<sg_host_t> *allocation;
68 /* SimDag private functions */
69 XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state);
70 XBT_PRIVATE void SD_task_run(SD_task_t task);
71 XBT_PRIVATE bool acyclic_graph_detail(xbt_dynar_t dag);
72 XBT_PRIVATE void uniq_transfer_task_name(SD_task_t task);
74 /* Task mallocator functions */
75 XBT_PRIVATE void* SD_task_new_f();
76 XBT_PRIVATE void SD_task_recycle_f(void *t);
77 XBT_PRIVATE void SD_task_free_f(void *t);