Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
remove speedTrace from the CPU constructor
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Mar 2016 02:51:57 +0000 (03:51 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 00:01:28 +0000 (01:01 +0100)
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/vm_hl13.cpp

index 1ccdcb8..dabefd7 100644 (file)
@@ -82,12 +82,12 @@ CpuCas01Model::~CpuCas01Model()
   delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 }
 
-Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core)
+Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
 {
-  xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
+  xbt_assert(xbt_dynar_getfirst_as(speedList, double) > 0.0,
       "Speed has to be >0.0. Did you forget to specify the mandatory power attribute?");
   xbt_assert(core > 0, "Invalid number of cores %d. Must be larger than 0", core);
-  return new CpuCas01(this, host, speedPeak, speedTrace, core);
+  return new CpuCas01(this, host, speedList, core);
 }
 
 double CpuCas01Model::next_occuring_event_full(double /*now*/)
@@ -98,18 +98,14 @@ double CpuCas01Model::next_occuring_event_full(double /*now*/)
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
-    tmgr_trace_t speedTrace, int core)
+CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
 : Cpu(model, host,
-    lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPeak, 0/*pstate*/, double)),
-    speedPeak, core, xbt_dynar_get_as(speedPeak, 0/*pstate*/, double))
+    lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedList, 0/*pstate*/, double)),
+    speedList, core, xbt_dynar_get_as(speedList, 0/*pstate*/, double))
 {
-
   XBT_DEBUG("CPU create: peak=%f, pstate=%d", speed_.peak, pstate_);
 
   coresAmount_ = core;
-  if (speedTrace)
-    speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this);
 }
 
 CpuCas01::~CpuCas01()
index 3934552..6c43dd7 100644 (file)
@@ -27,7 +27,7 @@ public:
   CpuCas01Model();
   ~CpuCas01Model();
 
-  Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) override;
   double next_occuring_event_full(double now) override;
   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 };
@@ -38,8 +38,7 @@ public:
 
 class CpuCas01 : public Cpu {
 public:
-  CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
-      tmgr_trace_t speedTrace, int core);
+  CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core);
   ~CpuCas01();
   void apply_event(tmgr_trace_iterator_t event, double value) override;
   CpuAction *execution_start(double size) override;
index 1b050c8..a0c958c 100644 (file)
@@ -43,11 +43,10 @@ public:
    * @brief Create a Cpu
    *
    * @param host The host that will have this CPU
-   * @param speedPeak The peak spead (max speed in Flops when no external load comes from a trace)
-   * @param speedTrace Speed variations
+   * @param speedList The peak speed (max speed in Flops when no external load comes from a trace) for each pstate
    * @param core The number of core of this Cpu
    */
-  virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core)=0;
+  virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)=0;
 
   void updateActionsStateLazy(double now, double delta);
   void updateActionsStateFull(double now, double delta);
@@ -70,7 +69,7 @@ public:
    * @param model The CpuModel associated to this Cpu
    * @param host The host in which this Cpu should be plugged
    * @param constraint The lmm constraint associated to this Cpu if it is part of a LMM component
-   * @param speedPeakList [TODO]
+   * @param speedList [TODO]
    * @param core The number of core of this Cpu
    * @param speedPeak The speed peak of this Cpu in flops (max speed)
    */
index 1b21c45..6dfd69e 100644 (file)
@@ -414,15 +414,12 @@ CpuTiModel::~CpuTiModel()
   xbt_heap_free(tiActionHeap_);
 }
 
-Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host,
-    xbt_dynar_t speedPeak,
-    tmgr_trace_t speedTrace,
-    int core)
+Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core)
 {
   xbt_assert(core==1,"Multi-core not handled with this model yet");
-  xbt_assert(xbt_dynar_getfirst_as(speedPeak, double) > 0.0,
+  xbt_assert(xbt_dynar_getfirst_as(speeds, double) > 0.0,
       "Speed has to be >0.0. Did you forget to specify the mandatory speed attribute?");
-  return new CpuTi(this, host, speedPeak, speedTrace, core);
+  return new CpuTi(this, host, speeds, core);
 }
 
 double CpuTiModel::next_occuring_event(double now)
@@ -464,20 +461,18 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
 /************
  * Resource *
  ************/
-CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
-        tmgr_trace_t speedTrace, int core)
+CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core)
   : Cpu(model, host, NULL, core, 0)
 {
   xbt_assert(core==1,"Multi-core not handled by this model yet");
   coresAmount_ = core;
 
-
   actionSet_ = new ActionTiList();
 
   xbt_dynar_get_cpy(speedPeak, 0, &speed_.peak);
   XBT_DEBUG("CPU create: peak=%f", speed_.peak);
 
-  setSpeedTrace(speedTrace);
+  speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/);
 }
 
 CpuTi::~CpuTi()
index 3f531d8..5e737a6 100644 (file)
@@ -110,7 +110,7 @@ typedef boost::intrusive::list<CpuTiAction, ActionTiListOptions > ActionTiList;
  ************/
 class CpuTi : public Cpu {
 public:
-  CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, tmgr_trace_t speedTrace, int core);
+  CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core);
   ~CpuTi();
 
   void setSpeedTrace(tmgr_trace_t trace) override;
@@ -147,8 +147,7 @@ class CpuTiModel : public CpuModel {
 public:
   CpuTiModel();
   ~CpuTiModel();
-  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPeak,
-      tmgr_trace_t speedTrace, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speeds, int core) override;
   double next_occuring_event(double now) override;
   void updateActionsState(double now, double delta) override;
 
index 31d8c77..9c70b31 100644 (file)
@@ -264,28 +264,23 @@ Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst,
   sg_host_t*host_list = xbt_new0(sg_host_t, 2);
   double *flops_amount = xbt_new0(double, 2);
   double *bytes_amount = xbt_new0(double, 4);
-  Action *res = NULL;
 
   host_list[0] = sg_host_by_name(src->name());
   host_list[1] = sg_host_by_name(dst->name());
   bytes_amount[1] = size;
 
-  res = p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
-
-  return res;
+  return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
 }
 
-Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  xbt_dynar_t powerPeakList,
-    tmgr_trace_t power_trace, int core)
+Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedsList, int core)
 {
-  return new CpuL07(this, host, powerPeakList, power_trace, core);
+  return new CpuL07(this, host, speedsList, core);
 }
 
 Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency,
     e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
 {
-  xbt_assert(!Link::byName(name),
-           "Link '%s' declared several times in the platform.", name);
+  xbt_assert(!Link::byName(name), "Link '%s' declared several times in the platform.", name);
 
   Link* link = new LinkL07(this, name, properties, bandwidth, latency, policy);
   Link::onCreation(link);
@@ -296,16 +291,10 @@ Link* NetworkL07Model::createLink(const char *name, double bandwidth, double lat
  * Resource *
  ************/
 
-CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host,
-    xbt_dynar_t speedPeakList,
-    tmgr_trace_t speedTrace,
-    int core)
- : Cpu(model, host, speedPeakList, core, xbt_dynar_get_as(speedPeakList,0,double))
+CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
+ : Cpu(model, host, speedList, core, xbt_dynar_get_as(speedList,0,double))
 {
-  p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPeakList,0,double));
-
-  if (speedTrace)
-    speed_.event = future_evt_set->add_trace(speedTrace, 0.0, this);
+  p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedList,0,double));
 }
 
 CpuL07::~CpuL07()
index ea5c913..1fc2a88 100644 (file)
@@ -54,8 +54,7 @@ public:
   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
   ~CpuL07Model();
 
-  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPeakList,
-                          tmgr_trace_t speedTrace, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedsList, int core) override;
   HostL07Model *p_hostModel;
 };
 
@@ -79,7 +78,7 @@ public:
 
 class CpuL07 : public Cpu {
 public:
-  CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeakList, tmgr_trace_t power_trace, int core);
+  CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core);
   ~CpuL07();
   bool isUsed() override;
   void apply_event(tmgr_trace_iterator_t event, double value) override;
index c1b9bdf..5236231 100644 (file)
@@ -115,10 +115,11 @@ void sg_platf_new_host(sg_platf_host_cbarg_t host)
 
   simgrid::surf::Cpu *cpu = surf_cpu_model_pm->createCpu( h,
       host->speed_peak,
-      host->speed_trace,
       host->core_amount);
   if (host->state_trace)
     cpu->setStateTrace(host->state_trace);
+  if (host->speed_trace)
+    cpu->setSpeedTrace(host->speed_trace);
   surf_host_model->createHost(host->id, netcard, cpu, host->properties)->attach(h);
 
   if (host->pstate != 0)
index 8939028..63248cf 100644 (file)
@@ -131,9 +131,7 @@ VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props, sg_host_t hos
   CpuCas01 *sub_cpu = static_cast<CpuCas01*>(host_PM->pimpl_cpu);
 
   p_cpu = surf_cpu_model_vm->createCpu(host_VM, // the machine hosting the VM
-      sub_cpu->getSpeedPeakList(),        // host->speed_peak,
-      NULL,                       // host->speed_trace,
-      1);                         // host->core_amount,
+      sub_cpu->getSpeedPeakList(), 1 /*cores*/);
   if (sub_cpu->getPState() != 0)
     p_cpu->setPState(sub_cpu->getPState());