int select = xbt_cfg_get_boolean(_sg_cfg_set, "cpu/maxmin_selective_update");
if (!strcmp(optim, "Full")) {
- p_updateMechanism = UM_FULL;
- m_selectiveUpdate = select;
+ updateMechanism_ = UM_FULL;
+ selectiveUpdate_ = select;
} else if (!strcmp(optim, "Lazy")) {
- p_updateMechanism = UM_LAZY;
- m_selectiveUpdate = 1;
+ updateMechanism_ = UM_LAZY;
+ selectiveUpdate_ = 1;
xbt_assert((select == 1)
||
(xbt_cfg_is_default_value
p_cpuRunningActionSetThatDoesNotNeedBeingChecked = new ActionList();
- p_maxminSystem = lmm_system_new(m_selectiveUpdate);
+ maxminSystem_ = lmm_system_new(selectiveUpdate_);
if (getUpdateMechanism() == UM_LAZY) {
- p_actionHeap = xbt_heap_new(8, NULL);
- xbt_heap_set_update_callback(p_actionHeap, surf_action_lmm_update_index_heap);
- p_modifiedSet = new ActionLmmList();
- p_maxminSystem->keep_track = p_modifiedSet;
+ actionHeap_ = xbt_heap_new(8, NULL);
+ xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
+ modifiedSet_ = new ActionLmmList();
+ maxminSystem_->keep_track = modifiedSet_;
}
}
CpuCas01Model::~CpuCas01Model()
{
- lmm_system_free(p_maxminSystem);
- p_maxminSystem = NULL;
+ lmm_system_free(maxminSystem_);
+ maxminSystem_ = NULL;
- if (p_actionHeap)
- xbt_heap_free(p_actionHeap);
- delete p_modifiedSet;
+ if (actionHeap_)
+ xbt_heap_free(actionHeap_);
+ delete modifiedSet_;
surf_cpu_model_pm = NULL;
double CpuCas01Model::next_occuring_event_full(double /*now*/)
{
- return Model::shareResourcesMaxMin(getRunningActionSet(), p_maxminSystem, lmm_solve);
+ return Model::shareResourcesMaxMin(getRunningActionSet(), maxminSystem_, lmm_solve);
}
/************
int select = xbt_cfg_get_boolean(_sg_cfg_set, "network/maxmin_selective_update");
if (!strcmp(optim, "Full")) {
- p_updateMechanism = UM_FULL;
- m_selectiveUpdate = select;
+ updateMechanism_ = UM_FULL;
+ selectiveUpdate_ = select;
} else if (!strcmp(optim, "Lazy")) {
- p_updateMechanism = UM_LAZY;
- m_selectiveUpdate = 1;
+ updateMechanism_ = UM_LAZY;
+ selectiveUpdate_ = 1;
xbt_assert((select == 1) || (xbt_cfg_is_default_value(_sg_cfg_set, "network/maxmin_selective_update")),
"Disabling selective update while using the lazy update mechanism is dumb!");
} else {
xbt_die("Unsupported optimization (%s) for this model", optim);
}
- if (!p_maxminSystem)
- p_maxminSystem = lmm_system_new(m_selectiveUpdate);
+ if (!maxminSystem_)
+ maxminSystem_ = lmm_system_new(selectiveUpdate_);
routing_model_create(createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL));
- if (p_updateMechanism == UM_LAZY) {
- p_actionHeap = xbt_heap_new(8, NULL);
- xbt_heap_set_update_callback(p_actionHeap, surf_action_lmm_update_index_heap);
- p_modifiedSet = new ActionLmmList();
- p_maxminSystem->keep_track = p_modifiedSet;
+ if (updateMechanism_ == UM_LAZY) {
+ actionHeap_ = xbt_heap_new(8, NULL);
+ xbt_heap_set_update_callback(actionHeap_, surf_action_lmm_update_index_heap);
+ modifiedSet_ = new ActionLmmList();
+ maxminSystem_->keep_track = modifiedSet_;
}
}
{
xbt_assert(NULL == Link::byName(name), "Link '%s' declared several times in the platform", name);
- Link* link = new NetworkCm02Link(this, name, properties, p_maxminSystem, sg_bandwidth_factor * bandwidth, bandwidth, latency, policy);
+ Link* link = new NetworkCm02Link(this, name, properties, maxminSystem_, sg_bandwidth_factor * bandwidth, bandwidth, latency, policy);
Link::onCreation(link);
return link;
}
void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
{
NetworkCm02Action *action;
- while ((xbt_heap_size(p_actionHeap) > 0)
- && (double_equals(xbt_heap_maxkey(p_actionHeap), now, sg_surf_precision))) {
- action = static_cast<NetworkCm02Action*> (xbt_heap_pop(p_actionHeap));
+ while ((xbt_heap_size(actionHeap_) > 0)
+ && (double_equals(xbt_heap_maxkey(actionHeap_), now, sg_surf_precision))) {
+ action = static_cast<NetworkCm02Action*> (xbt_heap_pop(actionHeap_));
XBT_DEBUG("Something happened to action %p", action);
if (TRACE_is_enabled()) {
- int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
+ int n = lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable());
for (int i = 0; i < n; i++){
- lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i);
+ lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
NetworkCm02Link *link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
TRACE_surf_link_set_utilization(link->getName(),
action->getCategory(),
(lmm_variable_getvalue(action->getVariable())*
- lmm_get_cnst_weight_from_var(p_maxminSystem,
+ lmm_get_cnst_weight_from_var(maxminSystem_,
action->getVariable(),
i)),
action->getLastUpdate(),
// if I am wearing a latency hat
if (action->getHat() == LATENCY) {
XBT_DEBUG("Latency paid for action %p. Activating", action);
- lmm_update_variable_weight(p_maxminSystem, action->getVariable(), action->m_weight);
- action->heapRemove(p_actionHeap);
+ lmm_update_variable_weight(maxminSystem_, action->getVariable(), action->m_weight);
+ action->heapRemove(actionHeap_);
action->refreshLastUpdate();
// if I am wearing a max_duration or normal hat
action->setRemains(0);
action->finish();
action->setState(SURF_ACTION_DONE);
- action->heapRemove(p_actionHeap);
+ action->heapRemove(actionHeap_);
action->gapRemove();
}
action->m_latency = 0.0;
}
if (action->m_latency == 0.0 && !(action->isSuspended()))
- lmm_update_variable_weight(p_maxminSystem, action->getVariable(),
+ lmm_update_variable_weight(maxminSystem_, action->getVariable(),
action->m_weight);
}
if (TRACE_is_enabled()) {
- int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
+ int n = lmm_get_number_of_cnst_from_var(maxminSystem_, action->getVariable());
for (int i = 0; i < n; i++){
- lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i);
+ lmm_constraint_t constraint = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i);
NetworkCm02Link* link = static_cast<NetworkCm02Link*>(lmm_constraint_id(constraint));
TRACE_surf_link_set_utilization(link->getName(),
action->getCategory(),
(lmm_variable_getvalue(action->getVariable())*
- lmm_get_cnst_weight_from_var(p_maxminSystem,
+ lmm_get_cnst_weight_from_var(maxminSystem_,
action->getVariable(),
i)),
action->getLastUpdate(),
now - action->getLastUpdate());
}
}
- if (!lmm_get_number_of_cnst_from_var (p_maxminSystem, action->getVariable())) {
+ if (!lmm_get_number_of_cnst_from_var (maxminSystem_, action->getVariable())) {
/* There is actually no link used, hence an infinite bandwidth.
* This happens often when using models like vivaldi.
* In such case, just make sure that the action completes immediately.
action->m_weight = action->m_latency = latency;
action->m_rate = rate;
- if (p_updateMechanism == UM_LAZY) {
+ if (updateMechanism_ == UM_LAZY) {
action->m_indexHeap = -1;
action->m_lastUpdate = surf_get_clock();
}
constraints_per_variable += back_route->size();
if (action->m_latency > 0) {
- action->p_variable = lmm_variable_new(p_maxminSystem, action, 0.0, -1.0, constraints_per_variable);
- if (p_updateMechanism == UM_LAZY) {
+ action->p_variable = lmm_variable_new(maxminSystem_, action, 0.0, -1.0, constraints_per_variable);
+ if (updateMechanism_ == UM_LAZY) {
// add to the heap the event when the latency is payed
XBT_DEBUG("Added action (%p) one latency event at date %f", action, action->m_latency + action->m_lastUpdate);
- action->heapInsert(p_actionHeap, action->m_latency + action->m_lastUpdate, route->empty() ? NORMAL : LATENCY);
+ action->heapInsert(actionHeap_, action->m_latency + action->m_lastUpdate, route->empty() ? NORMAL : LATENCY);
}
} else
- action->p_variable = lmm_variable_new(p_maxminSystem, action, 1.0, -1.0, constraints_per_variable);
+ action->p_variable = lmm_variable_new(maxminSystem_, action, 1.0, -1.0, constraints_per_variable);
if (action->m_rate < 0) {
- lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
+ lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
} else {
- lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
+ lmm_update_variable_bound(maxminSystem_, action->getVariable(), (action->m_latCurrent > 0) ? std::min(action->m_rate, sg_tcp_gamma / (2.0 * action->m_latCurrent)) : action->m_rate);
}
for (auto link: *route)
- lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), 1.0);
+ lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), 1.0);
if (sg_network_crosstraffic == 1) {
XBT_DEBUG("Fullduplex active adding backward flow using 5%%");
for (auto link : *back_route)
- lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), .05);
+ lmm_expand(maxminSystem_, link->getConstraint(), action->getVariable(), .05);
//Change concurrency_share here, if you want that cross-traffic is included in the SURF concurrency
//(You would also have to change lmm_element_concurrency())
if (!double_equals(penalized_bw, rate_before_update, sg_surf_precision)){
XBT_DEBUG("%d->%d action %p penalty updated : bw now %f, before %f , initial rate %f", root->id,(*it)->destination->id,(*it)->action,penalized_bw, (*it)->action->getBound(), (*it)->init_rate );
- lmm_update_variable_bound(p_maxminSystem, (*it)->action->getVariable(), penalized_bw);
+ lmm_update_variable_bound(maxminSystem_, (*it)->action->getVariable(), penalized_bw);
}else{
XBT_DEBUG("%d->%d action %p penalty not updated : bw %f, initial rate %f", root->id,(*it)->destination->id,(*it)->action,penalized_bw, (*it)->init_rate );
}
ActionList *runningActions = surf_network_model->getRunningActionSet();
double minRes;
- minRes = shareResourcesMaxMin(runningActions, surf_network_model->p_maxminSystem, surf_network_model->f_networkSolve);
+ minRes = shareResourcesMaxMin(runningActions, surf_network_model->maxminSystem_, surf_network_model->f_networkSolve);
for(ActionList::iterator it(runningActions->begin()), itend(runningActions->end())
; it != itend ; ++it) {
/** @brief Destructor */
~NetworkModel() {
- if (p_maxminSystem)
- lmm_system_free(p_maxminSystem);
- if (p_actionHeap)
- xbt_heap_free(p_actionHeap);
- if (p_modifiedSet)
- delete p_modifiedSet;
+ if (maxminSystem_)
+ lmm_system_free(maxminSystem_);
+ if (actionHeap_)
+ xbt_heap_free(actionHeap_);
+ delete modifiedSet_;
}
/**
namespace surf {
HostL07Model::HostL07Model() : HostModel() {
- p_maxminSystem = lmm_system_new(1);
- surf_network_model = new NetworkL07Model(this,p_maxminSystem);
- surf_cpu_model_pm = new CpuL07Model(this,p_maxminSystem);
+ maxminSystem_ = lmm_system_new(1);
+ surf_network_model = new NetworkL07Model(this,maxminSystem_);
+ surf_cpu_model_pm = new CpuL07Model(this,maxminSystem_);
routing_model_create(surf_network_model->createLink("__loopback__", 498000000, 0.000015, SURF_LINK_FATPIPE, NULL));
}
: CpuModel()
, p_hostModel(hmodel)
{
- p_maxminSystem = sys;
+ maxminSystem_ = sys;
}
CpuL07Model::~CpuL07Model() {
surf_cpu_model_pm = NULL;
- lmm_system_free(p_maxminSystem);
- p_maxminSystem = NULL;
+ lmm_system_free(maxminSystem_);
+ maxminSystem_ = NULL;
}
NetworkL07Model::NetworkL07Model(HostL07Model *hmodel, lmm_system_t sys)
: NetworkModel()
, p_hostModel(hmodel)
{
- p_maxminSystem = sys;
+ maxminSystem_ = sys;
}
NetworkL07Model::~NetworkL07Model()
{
surf_network_model = NULL;
- p_maxminSystem = NULL; // Avoid multi-free
+ maxminSystem_ = NULL; // Avoid multi-free
}
ActionList *running_actions = getRunningActionSet();
double min = this->shareResourcesMaxMin(running_actions,
- p_maxminSystem,
+ maxminSystem_,
bottleneck_solve);
for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
}
if ((action->m_latency == 0.0) && (action->isSuspended() == 0)) {
action->updateBound();
- lmm_update_variable_weight(p_maxminSystem, action->getVariable(), 1.0);
+ lmm_update_variable_weight(maxminSystem_, action->getVariable(), 1.0);
}
}
XBT_DEBUG("Action (%p) : remains (%g) updated by %g.",
lmm_constraint_t cnst = NULL;
int i = 0;
- while ((cnst = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i++))) {
+ while ((cnst = lmm_get_cnst_from_var(maxminSystem_, action->getVariable(), i++))) {
void *constraint_id = lmm_constraint_id(cnst);
if (static_cast<HostImpl*>(constraint_id)->isOff()) {
}
StorageModel::~StorageModel(){
- lmm_system_free(p_maxminSystem);
+ lmm_system_free(maxminSystem_);
surf_storage_model = NULL;
storage_running_action_set_that_does_not_need_being_checked =
xbt_swag_new(xbt_swag_offset(*action, p_stateHookup));
- if (!p_maxminSystem) {
- p_maxminSystem = lmm_system_new(storage_selective_update);
+ if (!maxminSystem_) {
+ maxminSystem_ = lmm_system_new(storage_selective_update);
}
}
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"),
"property Bconnection, storage",type_id);
- Storage *storage = new StorageN11(this, id, properties, p_maxminSystem,
+ Storage *storage = new StorageN11(this, id, properties, maxminSystem_,
Bread, Bwrite, Bconnection, type_id, (char *)content_name,
xbt_strdup(content_type), storage_type->size, (char *) attach);
storageCreatedCallbacks(storage);
StorageAction *write_action;
double min_completion = shareResourcesMaxMin(getRunningActionSet(),
- p_maxminSystem, lmm_solve);
+ maxminSystem_, lmm_solve);
double rate;
// Foreach disk
namespace surf {
Model::Model()
- : p_maxminSystem(NULL)
+ : maxminSystem_(NULL)
{
- p_readyActionSet = new ActionList();
- p_runningActionSet = new ActionList();
- p_failedActionSet = new ActionList();
- p_doneActionSet = new ActionList();
+ readyActionSet_ = new ActionList();
+ runningActionSet_ = new ActionList();
+ failedActionSet_ = new ActionList();
+ doneActionSet_ = new ActionList();
- p_modifiedSet = NULL;
- p_actionHeap = NULL;
- p_updateMechanism = UM_UNDEFINED;
- m_selectiveUpdate = 0;
+ modifiedSet_ = NULL;
+ actionHeap_ = NULL;
+ updateMechanism_ = UM_UNDEFINED;
+ selectiveUpdate_ = 0;
}
Model::~Model(){
- delete p_readyActionSet;
- delete p_runningActionSet;
- delete p_failedActionSet;
- delete p_doneActionSet;
+ delete readyActionSet_;
+ delete runningActionSet_;
+ delete failedActionSet_;
+ delete doneActionSet_;
}
double Model::next_occuring_event(double now)
{
//FIXME: set the good function once and for all
- if (p_updateMechanism == UM_LAZY)
+ if (updateMechanism_ == UM_LAZY)
return next_occuring_event_lazy(now);
- else if (p_updateMechanism == UM_FULL)
+ else if (updateMechanism_ == UM_FULL)
return next_occuring_event_full(now);
else
xbt_die("Invalid cpu update mechanism!");
XBT_DEBUG
("Before share resources, the size of modified actions set is %zd",
- p_modifiedSet->size());
+ modifiedSet_->size());
- lmm_solve(p_maxminSystem);
+ lmm_solve(maxminSystem_);
XBT_DEBUG
("After share resources, The size of modified actions set is %zd",
- p_modifiedSet->size());
+ modifiedSet_->size());
- while(!p_modifiedSet->empty()) {
- action = &(p_modifiedSet->front());
- p_modifiedSet->pop_front();
+ while(!modifiedSet_->empty()) {
+ action = &(modifiedSet_->front());
+ modifiedSet_->pop_front();
int max_dur_flag = 0;
- if (action->getStateSet() != p_runningActionSet)
+ if (action->getStateSet() != runningActionSet_)
continue;
/* bogus priority, skip it */
action->getMaxDuration());
if (min != -1) {
- action->heapUpdate(p_actionHeap, min, max_dur_flag ? MAX_DURATION : NORMAL);
+ action->heapUpdate(actionHeap_, min, max_dur_flag ? MAX_DURATION : NORMAL);
XBT_DEBUG("Insert at heap action(%p) min %f now %f", action, min,
now);
} else DIE_IMPOSSIBLE;
}
//hereafter must have already the min value for this resource model
- if (xbt_heap_size(p_actionHeap) > 0)
- min = xbt_heap_maxkey(p_actionHeap) - now;
+ if (xbt_heap_size(actionHeap_) > 0)
+ min = xbt_heap_maxkey(actionHeap_) - now;
else
min = -1;
void Model::updateActionsState(double now, double delta)
{
- if (p_updateMechanism == UM_FULL)
+ if (updateMechanism_ == UM_FULL)
updateActionsStateFull(now, delta);
- else if (p_updateMechanism == UM_LAZY)
+ else if (updateMechanism_ == UM_LAZY)
updateActionsStateLazy(now, delta);
else
xbt_die("Invalid cpu update mechanism!");
virtual ~Model();
/** @brief Get the set of [actions](@ref Action) in *ready* state */
- virtual ActionList* getReadyActionSet() {return p_readyActionSet;}
+ virtual ActionList* getReadyActionSet() {return readyActionSet_;}
/** @brief Get the set of [actions](@ref Action) in *running* state */
- virtual ActionList* getRunningActionSet() {return p_runningActionSet;}
+ virtual ActionList* getRunningActionSet() {return runningActionSet_;}
/** @brief Get the set of [actions](@ref Action) in *failed* state */
- virtual ActionList* getFailedActionSet() {return p_failedActionSet;}
+ virtual ActionList* getFailedActionSet() {return failedActionSet_;}
/** @brief Get the set of [actions](@ref Action) in *done* state */
- virtual ActionList* getDoneActionSet() {return p_doneActionSet;}
+ virtual ActionList* getDoneActionSet() {return doneActionSet_;}
/** @brief Get the set of modified [actions](@ref Action) */
- virtual ActionLmmListPtr getModifiedSet() {return p_modifiedSet;}
+ virtual ActionLmmListPtr getModifiedSet() {return modifiedSet_;}
/** @brief Get the maxmin system of the current Model */
- lmm_system_t getMaxminSystem() {return p_maxminSystem;}
+ lmm_system_t getMaxminSystem() {return maxminSystem_;}
/**
* @brief Get the update mechanism of the current Model
* @see e_UM_t
*/
- e_UM_t getUpdateMechanism() {return p_updateMechanism;}
+ e_UM_t getUpdateMechanism() {return updateMechanism_;}
/** @brief Get Action heap */
- xbt_heap_t getActionHeap() {return p_actionHeap;}
+ xbt_heap_t getActionHeap() {return actionHeap_;}
/**
* @brief Share the resources between the actions
virtual bool next_occuring_event_isIdempotent()=0;
protected:
- ActionLmmListPtr p_modifiedSet;
- lmm_system_t p_maxminSystem = nullptr;
- e_UM_t p_updateMechanism = UM_UNDEFINED;
- int m_selectiveUpdate;
- xbt_heap_t p_actionHeap;
+ ActionLmmListPtr modifiedSet_;
+ lmm_system_t maxminSystem_ = nullptr;
+ e_UM_t updateMechanism_ = UM_UNDEFINED;
+ int selectiveUpdate_;
+ xbt_heap_t actionHeap_;
private:
- ActionList* p_readyActionSet; /**< Actions in state SURF_ACTION_READY */
- ActionList* p_runningActionSet; /**< Actions in state SURF_ACTION_RUNNING */
- ActionList* p_failedActionSet; /**< Actions in state SURF_ACTION_FAILED */
- ActionList* p_doneActionSet; /**< Actions in state SURF_ACTION_DONE */
+ ActionList* readyActionSet_; /**< Actions in state SURF_ACTION_READY */
+ ActionList* runningActionSet_; /**< Actions in state SURF_ACTION_RUNNING */
+ ActionList* failedActionSet_; /**< Actions in state SURF_ACTION_FAILED */
+ ActionList* doneActionSet_; /**< Actions in state SURF_ACTION_DONE */
};
}