Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Update copyright lines.
[simgrid.git] / src / simdag / simdag_private.hpp
1 /* Copyright (c) 2006-2021. The SimGrid Team. All rights reserved.          */
2
3 /* This program is free software; you can redistribute it and/or modify it
4  * under the terms of the license (GNU LGPL) which comes with this package. */
5
6 #include "simgrid/simdag.h"
7 #include "surf/surf.hpp"
8 #include <set>
9 #include <string>
10 #include <vector>
11
12 #ifndef SIMDAG_PRIVATE_HPP
13 #define SIMDAG_PRIVATE_HPP
14 #if SIMGRID_HAVE_JEDULE
15 #include "simgrid/jedule/jedule_sd_binding.h"
16 #endif
17
18 namespace simgrid{
19 namespace sd{
20 class Global {
21 public:
22   bool watch_point_reached = false; /* has a task just reached a watch point? */
23   std::set<SD_task_t> initial_tasks;
24   std::set<SD_task_t> runnable_tasks;
25   std::set<SD_task_t> completed_tasks;
26   std::set<SD_task_t> return_set;
27 };
28
29 std::set<SD_task_t>* simulate (double how_long);
30 }
31 }
32
33 extern XBT_PRIVATE simgrid::sd::Global *sd_global;
34
35 /* Task */
36 struct s_SD_task_t {
37   e_SD_task_state_t state;
38   void *data;                   /* user data */
39   char *name;
40   e_SD_task_kind_t kind;
41   double amount;
42   double alpha;          /* used by typed parallel tasks */
43   double start_time;
44   double finish_time;
45   simgrid::kernel::resource::Action* surf_action;
46   unsigned short watch_points;  /* bit field xor()ed with masks */
47
48   bool marked = false; /* used to check if the task DAG has some cycle*/
49
50   /* dependencies -- cannot be embedded in the struct since it's not handled as a real C++ class */
51   std::set<SD_task_t> *inputs;
52   std::set<SD_task_t> *outputs;
53   std::set<SD_task_t> *predecessors;
54   std::set<SD_task_t> *successors;
55
56   /* scheduling parameters (only exist in state SD_SCHEDULED) */
57   std::vector<sg_host_t> *allocation;
58   double *flops_amount;
59   double *bytes_amount;
60   double rate;
61 };
62
63 /* SimDag private functions */
64 XBT_PRIVATE void SD_task_set_state(SD_task_t task, e_SD_task_state_t new_state);
65 XBT_PRIVATE void SD_task_run(SD_task_t task);
66 XBT_PRIVATE bool acyclic_graph_detail(const_xbt_dynar_t dag);
67 XBT_PRIVATE void uniq_transfer_task_name(SD_task_t task);
68 XBT_PRIVATE const char *__get_state_name(e_SD_task_state_t state);
69 #endif