From 355a8d7a17f462faebbac57c04517f44702a7652 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Sat, 19 Mar 2016 23:29:32 +0100 Subject: [PATCH] empty Cpu factories --- src/surf/cpu_cas01.cpp | 3 --- src/surf/cpu_interface.cpp | 4 +++- src/surf/cpu_ti.cpp | 7 ++----- src/surf/cpu_ti.hpp | 2 +- 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/surf/cpu_cas01.cpp b/src/surf/cpu_cas01.cpp index 271dce40a1..db15c1a98e 100644 --- a/src/surf/cpu_cas01.cpp +++ b/src/surf/cpu_cas01.cpp @@ -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); } diff --git a/src/surf/cpu_interface.cpp b/src/surf/cpu_interface.cpp index 72ab8bcbfa..3d8068c29c 100644 --- a/src/surf/cpu_interface.cpp +++ b/src/surf/cpu_interface.cpp @@ -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); diff --git a/src/surf/cpu_ti.cpp b/src/surf/cpu_ti.cpp index b846e20d4b..39c4b5c916 100644 --- a/src/surf/cpu_ti.cpp +++ b/src/surf/cpu_ti.cpp @@ -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) diff --git a/src/surf/cpu_ti.hpp b/src/surf/cpu_ti.hpp index ea853280a5..bf841ed359 100644 --- a/src/surf/cpu_ti.hpp +++ b/src/surf/cpu_ti.hpp @@ -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; -- 2.20.1