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);
-
- routing_model_create(surf_network_model->createLink("__loopback__",
- 498000000, NULL,
- 0.000015, NULL,
- NULL,
- SURF_LINK_FATPIPE, NULL));
+ 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));
}
HostL07Model::~HostL07Model() {
: 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()) {
}
-L07Action::L07Action(Model *model, int host_nb,
- sg_host_t*host_list,
- double *flops_amount,
- double *bytes_amount,
- double rate)
+L07Action::L07Action(Model *model, int host_nb, sg_host_t*host_list,
+ double *flops_amount, double *bytes_amount, double rate)
: CpuAction(model, 1, 0)
{
- unsigned int cpt;
int nb_link = 0;
int nb_used_host = 0; /* Only the hosts with something to compute (>0 flops) are counted) */
double latency = 0.0;
if (bytes_amount[i * host_nb + j] > 0) {
double lat=0.0;
- xbt_dynar_t route=NULL;
+ std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], &route, &lat);
+ routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], route, &lat);
latency = MAX(latency, lat);
- void *_link;
- xbt_dynar_foreach(route, cpt, _link) {
- LinkL07 *link = static_cast<LinkL07*>(_link);
+ for (auto link : *route)
xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
- }
+ delete route;
}
}
}
for (int i = 0; i < host_nb; i++) {
for (int j = 0; j < host_nb; j++) {
- xbt_dynar_t route=NULL;
if (bytes_amount[i * host_nb + j] == 0.0)
continue;
+ std::vector<Link*> *route = new std::vector<Link*>();
- routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j],
- &route, NULL);
+ routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], route, NULL);
- void *_link;
- xbt_dynar_foreach(route, cpt, _link) {
- LinkL07 *link = static_cast<LinkL07*>(_link);
- lmm_expand_add(model->getMaxminSystem(), link->getConstraint(),
- this->getVariable(), bytes_amount[i * host_nb + j]);
- }
+ for (auto link : *route)
+ lmm_expand_add(model->getMaxminSystem(), link->getConstraint(), this->getVariable(), bytes_amount[i * host_nb + j]);
+
+ delete route;
}
}
}
return cpu;
}
-Link* NetworkL07Model::createLink(const char *name,
- double bw_initial,
- tmgr_trace_t bw_trace,
- double lat_initial,
- tmgr_trace_t lat_trace,
- tmgr_trace_t state_trace,
- e_surf_link_sharing_policy_t policy,
- xbt_dict_t properties)
+Link* NetworkL07Model::createLink(const char *name, double bandwidth, double latency,
+ e_surf_link_sharing_policy_t policy, xbt_dict_t properties)
{
xbt_assert(!Link::byName(name),
- "Link '%s' declared several times in the platform file.", name);
+ "Link '%s' declared several times in the platform.", name);
- Link* link = new LinkL07(this, name, properties,
- bw_initial, bw_trace,
- lat_initial, lat_trace,
- state_trace,
- policy);
+ Link* link = new LinkL07(this, name, properties, bandwidth, latency, policy);
Link::onCreation(link);
return link;
}
{
}
-LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
- double bw_initial, tmgr_trace_t bw_trace,
- double lat_initial, tmgr_trace_t lat_trace,
- tmgr_trace_t state_trace,
+LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props, double bandwidth, double latency,
e_surf_link_sharing_policy_t policy)
- : Link(model, name, props, lmm_constraint_new(model->getMaxminSystem(), this, bw_initial), state_trace)
+ : Link(model, name, props, lmm_constraint_new(model->getMaxminSystem(), this, bandwidth))
{
- m_bandwidth.peak = bw_initial;
- if (bw_trace)
- m_bandwidth.event = future_evt_set->add_trace(bw_trace, 0.0, this);
-
- m_latency.peak = lat_initial;
- if (lat_trace)
- m_latency.event = future_evt_set->add_trace(lat_trace, 0.0, this);
+ m_bandwidth.peak = bandwidth;
+ m_latency.peak = latency;
if (policy == SURF_LINK_FATPIPE)
lmm_constraint_shared(getConstraint());
if (p_communicationAmount != NULL) {
for (i = 0; i < hostNb; i++) {
for (j = 0; j < hostNb; j++) {
- xbt_dynar_t route=NULL;
if (p_communicationAmount[i * hostNb + j] > 0) {
double lat = 0.0;
- routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j],
- &route, &lat);
+ std::vector<Link*> *route = new std::vector<Link*>();
+ routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j], route, &lat);
lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
+ delete route;
}
}
}