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
lua_pop(L, 1);
sg_platf_new_host(&host);
- xbt_dynar_free(&host.speed_peak);
+ xbt_dynar_free(&host.speed_per_pstate);
return 0;
}
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*/)
/************
* 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_);
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()
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;
};
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;
* 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)
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. */
}
if (p_constraintCoreId)
xbt_free(p_constraintCoreId);
- if (speedPeakList_)
- xbt_dynar_free(&speedPeakList_);
+ if (speedPerPstate_)
+ xbt_dynar_free(&speedPerPstate_);
}
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));
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);
* @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);
*
* @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();
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): */
/************
* 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");
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*/);
************/
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;
}
double current_speed_state;
- xbt_dynar_get_cpy(host->speed_peak, host->pstate, ¤t_speed_state);
+ xbt_dynar_get_cpy(host->speed_per_pstate, host->pstate, ¤t_speed_state);
new_pajeSetVariable (0, container, speed, current_speed_state);
}
if (TRACE_uncategorized()){
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,
* 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()
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;
};
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);
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,
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);
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));
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;
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, ",");
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);
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;
}