Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix Network Constant
[simgrid.git] / src / surf / workstation_ptask_L07.hpp
1 #include "workstation.hpp"
2
3 #ifndef WORKSTATION_L07_HPP_
4 #define WORKSTATION_L07_HPP_
5
6 /***********
7  * Classes *
8  ***********/
9
10 class WorkstationL07Model;
11 typedef WorkstationL07Model *WorkstationL07ModelPtr;
12
13 class CpuL07Model;
14 typedef CpuL07Model *CpuL07ModelPtr;
15
16 class NetworkL07Model;
17 typedef NetworkL07Model *NetworkL07ModelPtr;
18
19 class WorkstationL07;
20 typedef WorkstationL07 *WorkstationL07Ptr;
21
22 class CpuL07;
23 typedef CpuL07 *CpuL07Ptr;
24
25 class LinkL07;
26 typedef LinkL07 *LinkL07Ptr;
27
28 class WorkstationL07ActionLmm;
29 typedef WorkstationL07ActionLmm *WorkstationL07ActionLmmPtr;
30
31 /*FIXME:class WorkstationActionLmm;
32 typedef WorkstationActionLmm *WorkstationActionLmmPtr;*/
33
34 /*********
35  * Tools *
36  *********/
37
38 /*********
39  * Model *
40  *********/
41 class WorkstationL07Model : public WorkstationModel {
42 public:
43   WorkstationL07Model();
44
45   double shareResources(double now);
46   void updateActionsState(double now, double delta);
47   ResourcePtr createResource(const char *name, double power_scale,
48                                  double power_initial,
49                                  tmgr_trace_t power_trace,
50                                  e_surf_resource_state_t state_initial,
51                                  tmgr_trace_t state_trace,
52                                  xbt_dict_t cpu_properties);
53   ActionPtr executeParallelTask(int workstation_nb,
54                                         void **workstation_list,
55                                         double *computation_amount,
56                                         double *communication_amount,
57                                         double rate);
58   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst);
59   ActionPtr communicate(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst, double size, double rate);
60   void addTraces();
61   CpuL07ModelPtr p_cpuModel;
62   NetworkL07ModelPtr p_networkModel;
63 };
64
65 class CpuL07Model : public CpuModel {
66 public:
67   CpuL07Model() : CpuModel("cpuL07") {};
68   ResourcePtr createResource(const char *name, double power_scale,
69                                  double power_initial,
70                                  tmgr_trace_t power_trace,
71                                  e_surf_resource_state_t state_initial,
72                                  tmgr_trace_t state_trace,
73                                  xbt_dict_t cpu_properties);
74   void addTraces() {DIE_IMPOSSIBLE;};
75   WorkstationL07ModelPtr p_workstationModel;
76 };
77
78 class NetworkL07Model : public NetworkCm02Model {
79 public:
80   NetworkL07Model() : NetworkCm02Model(0) {};
81   ResourcePtr createResource(const char *name,
82                                                    double bw_initial,
83                                                    tmgr_trace_t bw_trace,
84                                                    double lat_initial,
85                                                    tmgr_trace_t lat_trace,
86                                                    e_surf_resource_state_t
87                                                    state_initial,
88                                                    tmgr_trace_t state_trace,
89                                                    e_surf_link_sharing_policy_t
90                                                    policy, xbt_dict_t properties);
91
92   xbt_dynar_t getRoute(WorkstationCLM03Ptr src, WorkstationCLM03Ptr dst) {DIE_IMPOSSIBLE;};
93   ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) {DIE_IMPOSSIBLE;};
94   void addTraces() {DIE_IMPOSSIBLE;};
95   WorkstationL07ModelPtr p_workstationModel;
96 };
97
98 /************
99  * Resource *
100  ************/
101
102 class WorkstationL07 : public WorkstationCLM03Lmm {
103 public:
104   WorkstationL07(WorkstationModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
105   bool isUsed();
106   void updateState(tmgr_trace_event_t event_type, double value, double date) {DIE_IMPOSSIBLE;};
107   ActionPtr execute(double size);
108   ActionPtr sleep(double duration);
109   e_surf_resource_state_t getState();
110 };
111
112 class CpuL07 : public CpuLmm {
113 public:
114   CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties);
115   bool isUsed() {DIE_IMPOSSIBLE;};
116   void updateState(tmgr_trace_event_t event_type, double value, double date);
117   e_surf_resource_state_t getState();
118   double getSpeed(double load);
119   double getAvailableSpeed();
120   ActionPtr execute(double size) {DIE_IMPOSSIBLE;};
121   ActionPtr sleep(double duration) {DIE_IMPOSSIBLE;};
122   double m_powerCurrent;
123 };
124
125 class LinkL07 : public NetworkCm02LinkLmm {
126 public:
127   LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props);
128   bool isUsed() {DIE_IMPOSSIBLE;};
129   void updateState(tmgr_trace_event_t event_type, double value, double date);
130   double getBandwidth();
131   double getLatency();
132   bool isShared();
133
134   double m_latCurrent;
135   tmgr_trace_event_t p_latEvent;
136   double m_bwCurrent;
137   tmgr_trace_event_t p_bwEvent;
138 };
139
140 /**********
141  * Action *
142  **********/
143 class WorkstationL07ActionLmm : public WorkstationActionLmm {
144 public:
145   WorkstationL07ActionLmm(ModelPtr model, double cost, bool failed)
146   : Action(model, cost, failed), WorkstationActionLmm(model, cost, failed) {};
147  ~WorkstationL07ActionLmm();
148
149   void updateBound();
150
151   int unref();
152   void cancel();
153   void suspend();
154   void resume();
155   bool isSuspended();
156   void setMaxDuration(double duration);
157   void setPriority(double priority);
158   double getRemains();
159
160   int m_workstationNb;
161   WorkstationCLM03Ptr *p_workstationList;
162   double *p_computationAmount;
163   double *p_communicationAmount;
164   double m_latency;
165   double m_rate;
166 };
167
168 #endif /* WORKSTATION_L07_HPP_ */