Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
empty Cpu factories
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Mar 2016 22:29:32 +0000 (23:29 +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_interface.cpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp

index 271dce4..db15c1a 100644 (file)
@@ -84,9 +84,6 @@ CpuCas01Model::~CpuCas01Model()
 
 Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
 {
-  xbt_assert(xbt_dynar_getfirst_as(speedPerPstate, 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, speedPerPstate, core);
 }
 
index 72ab8bc..3d8068c 100644 (file)
@@ -145,10 +145,12 @@ Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
  , coresAmount_(core)
  , host_(host)
 {
+  xbt_assert(core > 0, "Host %s must have at least one core, not 0.", host->name().c_str());
+
   speed_.peak = xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double);
   speed_.scale = 1;
   host->pimpl_cpu = this;
-  xbt_assert(speed_.scale > 0, "Available speed has to be >0");
+  xbt_assert(speed_.scale > 0, "Speed of host %s must be >0", host->name().c_str());
 
   // Copy the power peak array:
   speedPerPstate_ = xbt_dynar_new(sizeof(double), nullptr);
index b846e20..39c4b5c 100644 (file)
@@ -414,12 +414,9 @@ CpuTiModel::~CpuTiModel()
   xbt_heap_free(tiActionHeap_);
 }
 
-Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speeds, int core)
+Cpu *CpuTiModel::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
 {
-  xbt_assert(core==1,"Multi-core not handled with this model yet");
-  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, speeds, core);
+  return new CpuTi(this, host, speedPerPstate, core);
 }
 
 double CpuTiModel::next_occuring_event(double now)
index ea85328..bf841ed 100644 (file)
@@ -147,7 +147,7 @@ class CpuTiModel : public CpuModel {
 public:
   CpuTiModel();
   ~CpuTiModel();
-  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speeds, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPerPstate, int core) override;
   double next_occuring_event(double now) override;
   void updateActionsState(double now, double delta) override;