Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
c092c283ef4adc25e5301dd616c29ecb5db04ef4
[simgrid.git] / src / surf / host_ptask_L07.cpp
1 /* Copyright (c) 2007-2010, 2013-2015. The SimGrid Team.
2  * All rights reserved.                                                     */
3
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. */
6
7 #include "host_ptask_L07.hpp"
8
9 #include "cpu_interface.hpp"
10 #include "surf_routing.hpp"
11 #include "xbt/lib.h"
12
13 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_host);
14
15 static int ptask_host_count = 0;
16 static xbt_dict_t ptask_parallel_task_link_set = NULL;
17 lmm_system_t ptask_maxmin_system = NULL;
18
19
20 /**************************************/
21 /*** Resource Creation & Destruction **/
22 /**************************************/
23
24 static void ptask_netlink_parse_init(sg_platf_link_cbarg_t link)
25 {
26   netlink_parse_init(link);
27   current_property_set = NULL;
28 }
29
30 void surf_host_model_init_ptask_L07(void)
31 {
32   XBT_INFO("Switching to the L07 model to handle parallel tasks.");
33   xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
34   xbt_assert(!surf_network_model, "network model type already defined");
35
36   // Define the callbacks to parse the XML
37   sg_platf_link_add_cb(ptask_netlink_parse_init);
38   sg_platf_postparse_add_cb(host_add_traces);
39
40   surf_host_model = new HostL07Model();
41   Model *model = surf_host_model;
42   xbt_dynar_push(all_existing_models, &model);
43 }
44
45
46 HostL07Model::HostL07Model() : HostModel() {
47   if (!ptask_maxmin_system)
48         ptask_maxmin_system = lmm_system_new(1);
49   surf_host_model = NULL;
50   surf_network_model = new NetworkL07Model(this);
51   surf_cpu_model_pm = new CpuL07Model(this);
52
53   routing_model_create(surf_network_model->createLink("__loopback__",
54                                                           498000000, NULL,
55                                                           0.000015, NULL,
56                                                           SURF_RESOURCE_ON, NULL,
57                                                           SURF_LINK_FATPIPE, NULL));
58 }
59
60 HostL07Model::~HostL07Model() {
61   xbt_dict_free(&ptask_parallel_task_link_set);
62
63   delete surf_cpu_model_pm;
64   delete surf_network_model;
65   ptask_host_count = 0;
66
67   if (ptask_maxmin_system) {
68     lmm_system_free(ptask_maxmin_system);
69     ptask_maxmin_system = NULL;
70   }
71 }
72
73 double HostL07Model::shareResources(double /*now*/)
74 {
75   L07Action *action;
76
77   ActionList *running_actions = getRunningActionSet();
78   double min = this->shareResourcesMaxMin(running_actions,
79                                               ptask_maxmin_system,
80                                               bottleneck_solve);
81
82   for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
83          ; it != itend ; ++it) {
84         action = static_cast<L07Action*>(&*it);
85     if (action->m_latency > 0) {
86       if (min < 0) {
87         min = action->m_latency;
88         XBT_DEBUG("Updating min (value) with %p (start %f): %f", action,
89                action->getStartTime(), min);
90       } else if (action->m_latency < min) {
91         min = action->m_latency;
92         XBT_DEBUG("Updating min (latency) with %p (start %f): %f", action,
93                action->getStartTime(), min);
94       }
95     }
96   }
97
98   XBT_DEBUG("min value : %f", min);
99
100   return min;
101 }
102
103 void HostL07Model::updateActionsState(double /*now*/, double delta) {
104
105   L07Action *action;
106   ActionList *actionSet = getRunningActionSet();
107
108   for(ActionList::iterator it = actionSet->begin(), itNext = it
109          ; it != actionSet->end()
110          ; it =  itNext) {
111         ++itNext;
112     action = static_cast<L07Action*>(&*it);
113     if (action->m_latency > 0) {
114       if (action->m_latency > delta) {
115         double_update(&(action->m_latency), delta, sg_surf_precision);
116       } else {
117         action->m_latency = 0.0;
118       }
119       if ((action->m_latency == 0.0) && (action->isSuspended() == 0)) {
120         action->updateBound();
121         lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 1.0);
122       }
123     }
124     XBT_DEBUG("Action (%p) : remains (%g) updated by %g.",
125            action, action->getRemains(), lmm_variable_getvalue(action->getVariable()) * delta);
126     action->updateRemains(lmm_variable_getvalue(action->getVariable()) * delta);
127
128     if (action->getMaxDuration() != NO_MAX_DURATION)
129       action->updateMaxDuration(delta);
130
131     XBT_DEBUG("Action (%p) : remains (%g).", action, action->getRemains());
132
133     /* In the next if cascade, the action can be finished either because:
134      *  - The amount of remaining work reached 0
135      *  - The max duration was reached
136      * If it's not done, it may have failed.
137      */
138
139     if ((action->getRemains() <= 0) &&
140         (lmm_get_variable_weight(action->getVariable()) > 0)) {
141       action->finish();
142       action->setState(SURF_ACTION_DONE);
143     } else if ((action->getMaxDuration() != NO_MAX_DURATION) &&
144                (action->getMaxDuration() <= 0)) {
145       action->finish();
146       action->setState(SURF_ACTION_DONE);
147     } else {
148       /* Need to check that none of the model has failed */
149       lmm_constraint_t cnst = NULL;
150       int i = 0;
151
152       while ((cnst = lmm_get_cnst_from_var(ptask_maxmin_system, action->getVariable(), i++))) {
153         void *constraint_id = lmm_constraint_id(cnst);
154
155         if (static_cast<Host*>(constraint_id)->getState() == SURF_RESOURCE_OFF) {
156           XBT_DEBUG("Action (%p) Failed!!", action);
157           action->finish();
158           action->setState(SURF_ACTION_FAILED);
159           break;
160         }
161       }
162     }
163   }
164   return;
165 }
166
167 Action *HostL07Model::executeParallelTask(int host_nb,
168                                           sg_host_t*host_list,
169                                                                                   double *flops_amount,
170                                                                                   double *bytes_amount,
171                                                                                   double rate)
172 {
173   L07Action *action = new L07Action(this, 1, 0);
174   unsigned int cpt;
175   int nb_link = 0;
176   int nb_host = 0;
177   double latency = 0.0;
178
179   action->p_edgeList->reserve(host_nb);
180   for (int i = 0; i<host_nb; i++)
181           action->p_edgeList->push_back(sg_host_edge(host_list[i]));
182
183   if (ptask_parallel_task_link_set == NULL)
184     ptask_parallel_task_link_set = xbt_dict_new_homogeneous(NULL);
185
186   xbt_dict_reset(ptask_parallel_task_link_set);
187
188   /* Compute the number of affected resources... */
189   for (int i = 0; i < host_nb; i++) {
190     for (int j = 0; j < host_nb; j++) {
191       xbt_dynar_t route=NULL;
192
193       if (bytes_amount[i * host_nb + j] > 0) {
194         double lat=0.0;
195         unsigned int cpt;
196         void *_link;
197         LinkL07 *link;
198
199         routing_platf->getRouteAndLatency((*action->p_edgeList)[i], (*action->p_edgeList)[j],
200                                                   &route, &lat);
201         latency = MAX(latency, lat);
202
203         xbt_dynar_foreach(route, cpt, _link) {
204            link = static_cast<LinkL07*>(_link);
205            xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
206         }
207       }
208     }
209   }
210
211   nb_link = xbt_dict_length(ptask_parallel_task_link_set);
212   xbt_dict_reset(ptask_parallel_task_link_set);
213
214   for (int i = 0; i < host_nb; i++)
215     if (flops_amount[i] > 0)
216       nb_host++;
217
218   XBT_DEBUG("Creating a parallel task (%p) with %d cpus and %d links.",
219          action, host_nb, nb_link);
220   action->m_suspended = 0; /* valgrind seems to want it despite the calloc... */
221   action->p_computationAmount = flops_amount;
222   action->p_communicationAmount = bytes_amount;
223   action->m_latency = latency;
224   action->m_rate = rate;
225
226   action->p_variable = lmm_variable_new(ptask_maxmin_system, action, 1.0,
227                                         (rate > 0 ? rate : -1.0),
228                                                                                 host_nb + nb_link);
229
230   if (action->m_latency > 0)
231     lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
232
233   for (int i = 0; i < host_nb; i++)
234     lmm_expand(ptask_maxmin_system,
235                sg_host_surfcpu(host_list[i])->getConstraint(),
236                action->getVariable(), flops_amount[i]);
237
238   for (int i = 0; i < host_nb; i++) {
239     for (int j = 0; j < host_nb; j++) {
240       void *_link;
241
242       xbt_dynar_t route=NULL;
243       if (bytes_amount[i * host_nb + j] == 0.0)
244         continue;
245
246       routing_platf->getRouteAndLatency((*action->p_edgeList)[i], (*action->p_edgeList)[j],
247                                             &route, NULL);
248
249       xbt_dynar_foreach(route, cpt, _link) {
250         LinkL07 *link = static_cast<LinkL07*>(_link);
251         lmm_expand_add(ptask_maxmin_system, link->getConstraint(),
252                        action->getVariable(),
253                        bytes_amount[i * host_nb + j]);
254       }
255     }
256   }
257
258   if (nb_link + nb_host == 0) {
259     action->setCost(1.0);
260     action->setRemains(0.0);
261   }
262
263   return action;
264 }
265
266 Host *HostL07Model::createHost(const char *name)
267 {
268   HostL07 *wk = NULL;
269   sg_host_t sg_host = sg_host_by_name(name);
270
271   xbt_assert(!surf_host_resource_priv(sg_host),
272               "Host '%s' declared several times in the platform file.",
273               name);
274
275   wk = new HostL07(this, name, NULL,
276                                   sg_host_edge(sg_host),
277                                                   sg_host_surfcpu(sg_host));
278   surf_callback_emit(hostCreatedCallbacks, wk);
279   xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, wk);
280
281   return wk;
282 }
283
284 Action *NetworkL07Model::communicate(RoutingEdge *src, RoutingEdge *dst,
285                                        double size, double rate)
286 {
287   sg_host_t*host_list = xbt_new0(sg_host_t, 2);
288   double *flops_amount = xbt_new0(double, 2);
289   double *bytes_amount = xbt_new0(double, 4);
290   Action *res = NULL;
291
292   host_list[0] = sg_host_by_name(src->getName());
293   host_list[1] = sg_host_by_name(dst->getName());
294   bytes_amount[1] = size;
295
296   res = p_hostModel->executeParallelTask(2, host_list,
297                                     flops_amount,
298                                     bytes_amount, rate);
299
300   return res;
301 }
302
303 xbt_dynar_t HostL07Model::getRoute(Host *src, Host *dst)
304 {
305   xbt_dynar_t route=NULL;
306   routing_platf->getRouteAndLatency(src->p_netElm, dst->p_netElm, &route, NULL);
307   return route;
308 }
309
310 Cpu *CpuL07Model::createCpu(const char *name,  xbt_dynar_t powerPeak,
311                           int pstate, double power_scale,
312                           tmgr_trace_t power_trace, int core,
313                           e_surf_resource_state_t state_initial,
314                           tmgr_trace_t state_trace,
315                           xbt_dict_t cpu_properties)
316 {
317   double power_initial = xbt_dynar_get_as(powerPeak, pstate, double);
318   sg_host_t sg_host = sg_host_by_name(name);
319
320   xbt_assert(!surf_host_resource_priv(sg_host),
321               "Host '%s' declared several times in the platform file.",
322               name);
323
324   CpuL07 *cpu = new CpuL07(this, name, cpu_properties,
325                                      power_initial, power_scale, power_trace,
326                          core, state_initial, state_trace);
327   sg_host_surfcpu_register(sg_host, cpu);
328   return cpu;
329 }
330
331 Link* NetworkL07Model::createLink(const char *name,
332                                  double bw_initial,
333                                  tmgr_trace_t bw_trace,
334                                  double lat_initial,
335                                  tmgr_trace_t lat_trace,
336                                  e_surf_resource_state_t state_initial,
337                                  tmgr_trace_t state_trace,
338                                  e_surf_link_sharing_policy_t policy,
339                                  xbt_dict_t properties)
340 {
341   xbt_assert(!Link::byName(name),
342                  "Link '%s' declared several times in the platform file.", name);
343
344   Link* link = new LinkL07(this, name, properties,
345                              bw_initial, bw_trace,
346                                          lat_initial, lat_trace,
347                                          state_initial, state_trace,
348                                          policy);
349   surf_callback_emit(networkLinkCreatedCallbacks, link);
350   return link;
351 }
352
353 void HostL07Model::addTraces()
354 {
355   xbt_dict_cursor_t cursor = NULL;
356   char *trace_name, *elm;
357
358   if (!trace_connect_list_host_avail)
359     return;
360
361   /* Connect traces relative to cpu */
362   xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
363     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
364     CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
365
366     xbt_assert(host, "Host %s undefined", elm);
367     xbt_assert(trace, "Trace %s undefined", trace_name);
368
369     host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host);
370   }
371
372   xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
373     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
374     CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
375
376     xbt_assert(host, "Host %s undefined", elm);
377     xbt_assert(trace, "Trace %s undefined", trace_name);
378
379     host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host);
380   }
381
382   /* Connect traces relative to network */
383   xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
384     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
385     LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
386
387     xbt_assert(link, "Link %s undefined", elm);
388     xbt_assert(trace, "Trace %s undefined", trace_name);
389
390     link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
391   }
392
393   xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
394     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
395     LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
396
397     xbt_assert(link, "Link %s undefined", elm);
398     xbt_assert(trace, "Trace %s undefined", trace_name);
399
400     link->p_bwEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
401   }
402
403   xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
404     tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
405     LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
406
407     xbt_assert(link, "Link %s undefined", elm);
408     xbt_assert(trace, "Trace %s undefined", trace_name);
409
410     link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
411   }
412 }
413
414 /************
415  * Resource *
416  ************/
417
418 HostL07::HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu)
419   : Host(model, name, props, NULL, netElm, cpu)
420 {
421 }
422
423 double HostL07::getPowerPeakAt(int /*pstate_index*/)
424 {
425         THROW_UNIMPLEMENTED;
426 }
427
428 int HostL07::getNbPstates()
429 {
430         THROW_UNIMPLEMENTED;
431 }
432
433 void HostL07::setPstate(int /*pstate_index*/)
434 {
435         THROW_UNIMPLEMENTED;
436 }
437
438 int HostL07::getPstate()
439 {
440         THROW_UNIMPLEMENTED;
441 }
442
443 double HostL07::getConsumedEnergy()
444 {
445         THROW_UNIMPLEMENTED;
446 }
447
448 CpuL07::CpuL07(CpuL07Model *model, const char* name, xbt_dict_t props,
449                      double power_initial, double power_scale, tmgr_trace_t power_trace,
450                            int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
451  : Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale),
452            core, power_initial, power_scale, state_initial)
453 {
454   xbt_assert(m_powerScale > 0, "Power has to be >0");
455
456   if (power_trace)
457     p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0, this);
458   else
459     p_powerEvent = NULL;
460
461   if (state_trace)
462         p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
463 }
464
465 LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
466                          double bw_initial,
467                          tmgr_trace_t bw_trace,
468                          double lat_initial,
469                          tmgr_trace_t lat_trace,
470                          e_surf_resource_state_t state_initial,
471                          tmgr_trace_t state_trace,
472                          e_surf_link_sharing_policy_t policy)
473  : Link(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, bw_initial), history, state_trace)
474 {
475   m_bwCurrent = bw_initial;
476   if (bw_trace)
477     p_bwEvent = tmgr_history_add_trace(history, bw_trace, 0.0, 0, this);
478
479   setState(state_initial);
480   m_latCurrent = lat_initial;
481
482   if (lat_trace)
483         p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, this);
484
485   if (policy == SURF_LINK_FATPIPE)
486         lmm_constraint_shared(getConstraint());
487 }
488
489 Action *CpuL07::execute(double size)
490 {
491   sg_host_t*host_list = xbt_new0(sg_host_t, 1);
492   double *flops_amount = xbt_new0(double, 1);
493   double *bytes_amount = xbt_new0(double, 1);
494
495   host_list[0] = sg_host_by_name(getName());
496   flops_amount[0] = size;
497
498   return static_cast<HostL07Model*>(getModel())->executeParallelTask(1, host_list,
499                                               flops_amount,
500                                      bytes_amount, -1);
501 }
502
503 Action *CpuL07::sleep(double duration)
504 {
505   L07Action *action = NULL;
506
507   XBT_IN("(%s,%g)", getName(), duration);
508
509   action = static_cast<L07Action*>(execute(1.0));
510   action->m_maxDuration = duration;
511   action->m_suspended = 2;
512   lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
513
514   XBT_OUT();
515   return action;
516 }
517
518 bool CpuL07::isUsed(){
519   return lmm_constraint_used(ptask_maxmin_system, getConstraint());
520 }
521
522 bool LinkL07::isUsed(){
523   return lmm_constraint_used(ptask_maxmin_system, getConstraint());
524 }
525
526 void CpuL07::updateState(tmgr_trace_event_t event_type, double value, double /*date*/){
527   XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value);
528   if (event_type == p_powerEvent) {
529           m_powerScale = value;
530     lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_powerPeak * m_powerScale);
531     if (tmgr_trace_event_free(event_type))
532       p_powerEvent = NULL;
533   } else if (event_type == p_stateEvent) {
534     if (value > 0)
535       setState(SURF_RESOURCE_ON);
536     else
537       setState(SURF_RESOURCE_OFF);
538     if (tmgr_trace_event_free(event_type))
539       p_stateEvent = NULL;
540   } else {
541     XBT_CRITICAL("Unknown event ! \n");
542     xbt_abort();
543   }
544   return;
545 }
546
547 void LinkL07::updateState(tmgr_trace_event_t event_type, double value, double date) {
548   XBT_DEBUG("Updating link %s (%p) with value=%f for date=%g", getName(), this, value, date);
549   if (event_type == p_bwEvent) {
550     updateBandwidth(value, date);
551     if (tmgr_trace_event_free(event_type))
552       p_bwEvent = NULL;
553   } else if (event_type == p_latEvent) {
554     updateLatency(value, date);
555     if (tmgr_trace_event_free(event_type))
556       p_latEvent = NULL;
557   } else if (event_type == p_stateEvent) {
558     if (value > 0)
559       setState(SURF_RESOURCE_ON);
560     else
561       setState(SURF_RESOURCE_OFF);
562     if (tmgr_trace_event_free(event_type))
563       p_stateEvent = NULL;
564   } else {
565     XBT_CRITICAL("Unknown event ! \n");
566     xbt_abort();
567   }
568   return;
569 }
570
571 e_surf_resource_state_t HostL07::getState() {
572   return p_cpu->getState();
573 }
574
575
576 double LinkL07::getBandwidth()
577 {
578   return m_bwCurrent;
579 }
580
581 void LinkL07::updateBandwidth(double value, double date)
582 {
583   m_bwCurrent = value;
584   lmm_update_constraint_bound(ptask_maxmin_system, getConstraint(), m_bwCurrent);
585 }
586
587 double LinkL07::getLatency()
588 {
589   return m_latCurrent;
590 }
591
592 void LinkL07::updateLatency(double value, double date)
593 {
594   lmm_variable_t var = NULL;
595   L07Action *action;
596   lmm_element_t elem = NULL;
597
598   m_latCurrent = value;
599   while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
600     action = static_cast<L07Action*>(lmm_variable_id(var));
601     action->updateBound();
602   }
603 }
604
605
606 bool LinkL07::isShared()
607 {
608   return lmm_constraint_is_shared(getConstraint());
609 }
610
611 /**********
612  * Action *
613  **********/
614
615 L07Action::~L07Action(){
616   free(p_communicationAmount);
617   free(p_computationAmount);
618 }
619
620 void L07Action::updateBound()
621 {
622   double lat_current = 0.0;
623   double lat_bound = -1.0;
624   int i, j;
625
626   int hostNb = p_edgeList->size();
627
628   for (i = 0; i < hostNb; i++) {
629     for (j = 0; j < hostNb; j++) {
630       xbt_dynar_t route=NULL;
631
632       if (p_communicationAmount[i * hostNb + j] > 0) {
633         double lat = 0.0;
634         routing_platf->getRouteAndLatency((*p_edgeList)[i], (*p_edgeList)[j],
635                                                           &route, &lat);
636
637         lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
638       }
639     }
640   }
641   lat_bound = sg_tcp_gamma / (2.0 * lat_current);
642   XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
643   if ((m_latency == 0.0) && (m_suspended == 0)) {
644     if (m_rate < 0)
645       lmm_update_variable_bound(ptask_maxmin_system, getVariable(), lat_bound);
646     else
647       lmm_update_variable_bound(ptask_maxmin_system, getVariable(), min(m_rate, lat_bound));
648   }
649 }
650
651 int L07Action::unref()
652 {
653   m_refcount--;
654   if (!m_refcount) {
655     if (action_hook.is_linked())
656           p_stateSet->erase(p_stateSet->iterator_to(*this));
657     if (getVariable())
658       lmm_variable_free(ptask_maxmin_system, getVariable());
659     delete this;
660     return 1;
661   }
662   return 0;
663 }
664
665 void L07Action::cancel()
666 {
667   setState(SURF_ACTION_FAILED);
668   return;
669 }
670
671 void L07Action::suspend()
672 {
673   XBT_IN("(%p))", this);
674   if (m_suspended != 2) {
675     m_suspended = 1;
676     lmm_update_variable_weight(ptask_maxmin_system, getVariable(), 0.0);
677   }
678   XBT_OUT();
679 }
680
681 void L07Action::resume()
682 {
683   XBT_IN("(%p)", this);
684   if (m_suspended != 2) {
685     lmm_update_variable_weight(ptask_maxmin_system, getVariable(), 1.0);
686     m_suspended = 0;
687   }
688   XBT_OUT();
689 }
690
691 bool L07Action::isSuspended()
692 {
693   return m_suspended == 1;
694 }
695
696 void L07Action::setMaxDuration(double duration)
697 {                               /* FIXME: should inherit */
698   XBT_IN("(%p,%g)", this, duration);
699   m_maxDuration = duration;
700   XBT_OUT();
701 }
702
703 void L07Action::setPriority(double priority)
704 {                               /* FIXME: should inherit */
705   XBT_IN("(%p,%g)", this, priority);
706   m_priority = priority;
707   XBT_OUT();
708 }
709
710 double L07Action::getRemains()
711 {
712   XBT_IN("(%p)", this);
713   XBT_OUT();
714   return m_remains;
715 }