Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
get a better name for the speedPerPstate attribute in CPU
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 19 Mar 2016 22:14:06 +0000 (23:14 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 20 Mar 2016 00:01:28 +0000 (01:01 +0100)
13 files changed:
src/bindings/lua/lua_platf.cpp
src/surf/cpu_cas01.cpp
src/surf/cpu_cas01.hpp
src/surf/cpu_interface.cpp
src/surf/cpu_interface.hpp
src/surf/cpu_ti.cpp
src/surf/cpu_ti.hpp
src/surf/instr_routing.cpp
src/surf/ptask_L07.cpp
src/surf/ptask_L07.hpp
src/surf/sg_platf.cpp
src/surf/xml/platf_private.hpp
src/surf/xml/surfxml_sax_cb.cpp

index 5fb2ccd..c20e7c4 100644 (file)
@@ -181,11 +181,11 @@ int console_add_host(lua_State *L) {
   if (type != LUA_TSTRING && type != LUA_TNUMBER) {
     XBT_ERROR("Attribute 'speed' must be specified for host and must either be a string (in the correct format; check documentation) or a number.");
   }
-  host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
+  host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
   if (type == LUA_TNUMBER)
-    xbt_dynar_push_as(host.speed_peak, double, lua_tointeger(L, -1));
+    xbt_dynar_push_as(host.speed_per_pstate, double, lua_tointeger(L, -1));
   else // LUA_TSTRING
-    xbt_dynar_push_as(host.speed_peak, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
+    xbt_dynar_push_as(host.speed_per_pstate, double, surf_parse_get_speed(lua_tostring(L, -1), "speed of host", host.id));
   lua_pop(L, 1);
 
   // get core
@@ -216,7 +216,7 @@ int console_add_host(lua_State *L) {
   lua_pop(L, 1);
 
   sg_platf_new_host(&host);
-  xbt_dynar_free(&host.speed_peak);
+  xbt_dynar_free(&host.speed_per_pstate);
 
   return 0;
 }
index dabefd7..0a7f391 100644 (file)
@@ -82,12 +82,12 @@ CpuCas01Model::~CpuCas01Model()
   delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 }
 
-Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
+Cpu *CpuCas01Model::createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
 {
-  xbt_assert(xbt_dynar_getfirst_as(speedList, double) > 0.0,
+  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, speedList, core);
+  return new CpuCas01(this, host, speedPerPstate, core);
 }
 
 double CpuCas01Model::next_occuring_event_full(double /*now*/)
@@ -98,10 +98,10 @@ double CpuCas01Model::next_occuring_event_full(double /*now*/)
 /************
  * Resource *
  ************/
-CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)
+CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
 : Cpu(model, host,
-    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))
+    lmm_constraint_new(model->getMaxminSystem(), this, core * xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double)),
+    speedPerPstate, core, xbt_dynar_get_as(speedPerPstate, 0/*pstate*/, double))
 {
   XBT_DEBUG("CPU create: peak=%f, pstate=%d", speed_.peak, pstate_);
 
@@ -111,11 +111,11 @@ CpuCas01::CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t s
 CpuCas01::~CpuCas01()
 {
   if (getModel() == surf_cpu_model_pm)
-    xbt_dynar_free(&speedPeakList_);
+    xbt_dynar_free(&speedPerPstate_);
 }
 
 xbt_dynar_t CpuCas01::getSpeedPeakList(){
-  return speedPeakList_;
+  return speedPerPstate_;
 }
 
 bool CpuCas01::isUsed()
index 6c43dd7..cee9934 100644 (file)
@@ -27,7 +27,7 @@ public:
   CpuCas01Model();
   ~CpuCas01Model();
 
-  Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core) override;
   double next_occuring_event_full(double now) override;
   ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
 };
@@ -38,7 +38,7 @@ public:
 
 class CpuCas01 : public Cpu {
 public:
-  CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedList, int core);
+  CpuCas01(CpuCas01Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core);
   ~CpuCas01();
   void apply_event(tmgr_trace_iterator_t event, double value) override;
   CpuAction *execution_start(double size) override;
index ccdad63..6da354f 100644 (file)
@@ -134,13 +134,13 @@ void CpuModel::updateActionsStateFull(double now, double delta)
  * Resource *
  ************/
 Cpu::Cpu(Model *model, simgrid::s4u::Host *host,
-    xbt_dynar_t speedPeakList, int core, double speedPeak)
- : Cpu(model, host, NULL/*constraint*/, speedPeakList, core, speedPeak)
+    xbt_dynar_t speedPerPstate, int core, double speedPeak)
+ : Cpu(model, host, NULL/*constraint*/, speedPerPstate, core, speedPeak)
 {
 }
 
 Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
-    xbt_dynar_t speedPeakList, int core, double speedPeak)
+    xbt_dynar_t speedPerPstate, int core, double speedPeak)
  : Resource(model, host->name().c_str(), constraint)
  , coresAmount_(core)
  , host_(host)
@@ -151,11 +151,11 @@ Cpu::Cpu(Model *model, simgrid::s4u::Host *host, lmm_constraint_t constraint,
   xbt_assert(speed_.scale > 0, "Available speed has to be >0");
 
   // Copy the power peak array:
-  speedPeakList_ = xbt_dynar_new(sizeof(double), nullptr);
-  unsigned long n = xbt_dynar_length(speedPeakList);
+  speedPerPstate_ = xbt_dynar_new(sizeof(double), nullptr);
+  unsigned long n = xbt_dynar_length(speedPerPstate);
   for (unsigned long i = 0; i != n; ++i) {
-    double value = xbt_dynar_get_as(speedPeakList, i, double);
-    xbt_dynar_push(speedPeakList_, &value);
+    double value = xbt_dynar_get_as(speedPerPstate, i, double);
+    xbt_dynar_push(speedPerPstate_, &value);
   }
 
   /* Currently, we assume that a VM does not have a multicore CPU. */
@@ -185,8 +185,8 @@ Cpu::~Cpu()
   }
   if (p_constraintCoreId)
     xbt_free(p_constraintCoreId);
-  if (speedPeakList_)
-    xbt_dynar_free(&speedPeakList_);
+  if (speedPerPstate_)
+    xbt_dynar_free(&speedPerPstate_);
 }
 
 double Cpu::getCurrentPowerPeak()
@@ -196,12 +196,12 @@ double Cpu::getCurrentPowerPeak()
 
 int Cpu::getNbPStates()
 {
-  return xbt_dynar_length(speedPeakList_);
+  return xbt_dynar_length(speedPerPstate_);
 }
 
 void Cpu::setPState(int pstate_index)
 {
-  xbt_dynar_t plist = speedPeakList_;
+  xbt_dynar_t plist = speedPerPstate_;
   xbt_assert(pstate_index <= (int)xbt_dynar_length(plist),
       "Invalid parameters for CPU %s (pstate %d > length of pstates %d)", getName(), pstate_index, (int)xbt_dynar_length(plist));
 
@@ -219,7 +219,7 @@ int Cpu::getPState()
 
 double Cpu::getPowerPeakAt(int pstate_index)
 {
-  xbt_dynar_t plist = speedPeakList_;
+  xbt_dynar_t plist = speedPerPstate_;
   xbt_assert((pstate_index <= (int)xbt_dynar_length(plist)), "Invalid parameters (pstate index out of bounds)");
 
   return xbt_dynar_get_as(plist, pstate_index, double);
index a0c958c..2de8e3a 100644 (file)
@@ -43,10 +43,10 @@ public:
    * @brief Create a Cpu
    *
    * @param host The host that will have this CPU
-   * @param speedList The peak speed (max speed in Flops when no external load comes from a trace) for each pstate
+   * @param speedPerPstate Processor speed (in Flops) of each pstate. This ignores any potential external load coming from a trace.
    * @param core The number of core of this Cpu
    */
-  virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedList, int core)=0;
+  virtual Cpu *createCpu(simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)=0;
 
   void updateActionsStateLazy(double now, double delta);
   void updateActionsStateFull(double now, double delta);
@@ -81,12 +81,12 @@ public:
    *
    * @param model The CpuModel associated to this Cpu
    * @param host The host in which this Cpu should be plugged
-   * @param speedPeakList [TODO]
+   * @param speedPerPstate Processor speed (in flop per second) for each pstate
    * @param core The number of core of this Cpu
    * @param speedPeak The speed peak of this Cpu in flops (max speed)
    */
   Cpu(simgrid::surf::Model *model, simgrid::s4u::Host *host,
-      xbt_dynar_t speedPeakList, int core, double speedPeak);
+      xbt_dynar_t speedPerPstate, int core, double speedPeak);
 
   ~Cpu();
 
@@ -135,7 +135,7 @@ public:
   int coresAmount_ = 1;
   simgrid::s4u::Host* host_;
 
-  xbt_dynar_t speedPeakList_ = NULL; /*< List of supported CPU capacities (pstate related) */
+  xbt_dynar_t speedPerPstate_ = NULL; /*< List of supported CPU capacities (pstate related) */
   int pstate_ = 0;                   /*< Current pstate (index in the speedPeakList)*/
 
   /* Note (hypervisor): */
index 6dfd69e..d094a12 100644 (file)
@@ -461,7 +461,7 @@ void CpuTiModel::updateActionsState(double now, double /*delta*/)
 /************
  * Resource *
  ************/
-CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak, int core)
+CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
   : Cpu(model, host, NULL, core, 0)
 {
   xbt_assert(core==1,"Multi-core not handled by this model yet");
@@ -469,7 +469,7 @@ CpuTi::CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPeak,
 
   actionSet_ = new ActionTiList();
 
-  xbt_dynar_get_cpy(speedPeak, 0, &speed_.peak);
+  xbt_dynar_get_cpy(speedPerPstate, 0, &speed_.peak);
   XBT_DEBUG("CPU create: peak=%f", speed_.peak);
 
   speedIntegratedTrace_ = new CpuTiTgmr(NULL, 1/*scale*/);
index 5e737a6..ea85328 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, int core);
+  CpuTi(CpuTiModel *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core);
   ~CpuTi();
 
   void setSpeedTrace(tmgr_trace_t trace) override;
index 4523960..ad75117 100644 (file)
@@ -269,7 +269,7 @@ void sg_instr_new_host(sg_platf_host_cbarg_t host)
     }
 
     double current_speed_state;
-    xbt_dynar_get_cpy(host->speed_peak, host->pstate, &current_speed_state);
+    xbt_dynar_get_cpy(host->speed_per_pstate, host->pstate, &current_speed_state);
     new_pajeSetVariable (0, container, speed, current_speed_state);
   }
   if (TRACE_uncategorized()){
index 0f34db8..a5f9339 100644 (file)
@@ -271,9 +271,9 @@ Action *NetworkL07Model::communicate(NetCard *src, NetCard *dst, double size, do
   return p_hostModel->executeParallelTask(2, host_list, flops_amount, bytes_amount, rate);
 }
 
-Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedsList, int core)
+Cpu *CpuL07Model::createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPerPstate, int core)
 {
-  return new CpuL07(this, host, speedsList, core);
+  return new CpuL07(this, host, speedPerPstate, core);
 }
 
 Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency,
@@ -286,10 +286,10 @@ Link* NetworkL07Model::createLink(const char *name, double bandwidth, double lat
  * Resource *
  ************/
 
-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))
+CpuL07::CpuL07(CpuL07Model *model, simgrid::s4u::Host *host, xbt_dynar_t speedPerPstate, int core)
+ : Cpu(model, host, speedPerPstate, core, xbt_dynar_get_as(speedPerPstate,0,double))
 {
-  p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedList,0,double));
+  p_constraint = lmm_constraint_new(model->getMaxminSystem(), this, xbt_dynar_get_as(speedPerPstate,0,double));
 }
 
 CpuL07::~CpuL07()
index 1fc2a88..403ad2b 100644 (file)
@@ -54,7 +54,7 @@ public:
   CpuL07Model(HostL07Model *hmodel,lmm_system_t sys);
   ~CpuL07Model();
 
-  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedsList, int core) override;
+  Cpu *createCpu(simgrid::s4u::Host *host,  xbt_dynar_t speedPerPstate, int core) override;
   HostL07Model *p_hostModel;
 };
 
index 5236231..f65533f 100644 (file)
@@ -114,7 +114,7 @@ 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_per_pstate,
       host->core_amount);
   if (host->state_trace)
     cpu->setStateTrace(host->state_trace);
@@ -289,15 +289,15 @@ void sg_platf_new_cluster(sg_platf_cluster_cbarg_t cluster)
         XBT_DEBUG("\tstate_file=\"\"");
       }
 
-      host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
-      xbt_dynar_push(host.speed_peak,&cluster->speed);
+      host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+      xbt_dynar_push(host.speed_per_pstate,&cluster->speed);
       host.pstate = 0;
 
       //host.power_peak = cluster->power;
       host.core_amount = cluster->core_amount;
       host.coord = "";
       sg_platf_new_host(&host);
-      xbt_dynar_free(&host.speed_peak);
+      xbt_dynar_free(&host.speed_per_pstate);
       XBT_DEBUG("</host>");
 
       XBT_DEBUG("<link\tid=\"%s\"\tbw=\"%f\"\tlat=\"%f\"/>", link_id,
@@ -474,10 +474,10 @@ void sg_platf_new_cabinet(sg_platf_cabinet_cbarg_t cabinet)
       link_id                      = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix);
       host.id                      = host_id;
       link.id                      = link_id;
-      host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
-      xbt_dynar_push(host.speed_peak,&cabinet->speed);
+      host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+      xbt_dynar_push(host.speed_per_pstate,&cabinet->speed);
       sg_platf_new_host(&host);
-      xbt_dynar_free(&host.speed_peak);
+      xbt_dynar_free(&host.speed_per_pstate);
       sg_platf_new_link(&link);
 
       char* link_up       = bprintf("%s_UP",link_id);
@@ -724,15 +724,15 @@ void sg_platf_new_peer(sg_platf_peer_cbarg_t peer)
   memset(&host, 0, sizeof(host));
   host.id = host_id;
 
-  host.speed_peak = xbt_dynar_new(sizeof(double), NULL);
-  xbt_dynar_push(host.speed_peak,&peer->speed);
+  host.speed_per_pstate = xbt_dynar_new(sizeof(double), NULL);
+  xbt_dynar_push(host.speed_per_pstate,&peer->speed);
   host.pstate = 0;
   //host.power_peak = peer->power;
   host.speed_trace = peer->availability_trace;
   host.state_trace = peer->state_trace;
   host.core_amount = 1;
   sg_platf_new_host(&host);
-  xbt_dynar_free(&host.speed_peak);
+  xbt_dynar_free(&host.speed_per_pstate);
 
   s_sg_platf_link_cbarg_t link = SG_PLATF_LINK_INITIALIZER;
   memset(&link, 0, sizeof(link));
index f3c11b3..f2996de 100644 (file)
@@ -41,7 +41,7 @@ typedef enum {
 
 typedef struct {
   const char* id;
-  xbt_dynar_t speed_peak;
+  xbt_dynar_t speed_per_pstate;
   int pstate;
   int core_amount;
   tmgr_trace_t speed_trace;
index d98e65e..659d682 100644 (file)
@@ -455,10 +455,10 @@ void ETag_surfxml_host(void)    {
 
   buf = A_surfxml_host_speed;
   XBT_DEBUG("Buffer: %s", buf);
-  host.speed_peak = xbt_dynar_new(sizeof(double), nullptr);
+  host.speed_per_pstate = xbt_dynar_new(sizeof(double), nullptr);
   if (strchr(buf, ',') == nullptr){
     double speed = surf_parse_get_speed(A_surfxml_host_speed,"speed of host", host.id);
-    xbt_dynar_push_as(host.speed_peak,double, speed);
+    xbt_dynar_push_as(host.speed_per_pstate,double, speed);
   }
   else {
     xbt_dynar_t pstate_list = xbt_str_split(buf, ",");
@@ -470,7 +470,7 @@ void ETag_surfxml_host(void)    {
       xbt_dynar_get_cpy(pstate_list, i, &speed_str);
       xbt_str_trim(speed_str, nullptr);
       speed = surf_parse_get_speed(speed_str,"speed of host", host.id);
-      xbt_dynar_push_as(host.speed_peak, double, speed);
+      xbt_dynar_push_as(host.speed_per_pstate, double, speed);
       XBT_DEBUG("Speed value: %f", speed);
     }
     xbt_dynar_free(&pstate_list);
@@ -484,7 +484,7 @@ void ETag_surfxml_host(void)    {
   host.coord       = A_surfxml_host_coordinates;
 
   sg_platf_new_host(&host);
-  xbt_dynar_free(&host.speed_peak);
+  xbt_dynar_free(&host.speed_per_pstate);
   current_property_set = nullptr;
 }