this->p_netcardList->push_back(host_list[i]->pimpl_netcard);
/* Compute the number of affected resources... */
- 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) {
- double lat=0.0;
- unsigned int cpt;
- void *_link;
- LinkL07 *link;
-
- routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
- &route, &lat);
- latency = MAX(latency, lat);
-
- xbt_dynar_foreach(route, cpt, _link) {
- link = static_cast<LinkL07*>(_link);
- xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
+ if(bytes_amount != NULL) {
+ 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) {
+ double lat=0.0;
+ unsigned int cpt;
+ void *_link;
+ LinkL07 *link;
+
+ routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
+ &route, &lat);
+ latency = MAX(latency, lat);
+
+ xbt_dynar_foreach(route, cpt, _link) {
+ link = static_cast<LinkL07*>(_link);
+ xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
+ }
}
}
}
host_list[i]->pimpl_cpu->getConstraint(),
this->getVariable(), flops_amount[i]);
- for (int i = 0; i < host_nb; i++) {
- for (int j = 0; j < host_nb; j++) {
- void *_link;
+ if(bytes_amount != NULL) {
+ for (int i = 0; i < host_nb; i++) {
+ for (int j = 0; j < host_nb; j++) {
+ void *_link;
- xbt_dynar_t route=NULL;
- if (bytes_amount[i * host_nb + j] == 0.0)
- continue;
+ xbt_dynar_t route=NULL;
+ if (bytes_amount[i * host_nb + j] == 0.0)
+ continue;
- routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
- &route, NULL);
+ routing_platf->getRouteAndLatency((*this->p_netcardList)[i], (*this->p_netcardList)[j],
+ &route, NULL);
- 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]);
+ 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]);
+ }
}
}
}
lmm_constraint_shared(getConstraint());
}
-Action *CpuL07::execute(double size)
+Action *CpuL07::execution_start(double size)
{
sg_host_t*host_list = xbt_new0(sg_host_t, 1);
double *flops_amount = xbt_new0(double, 1);
host_list[0] = getHost();
flops_amount[0] = size;
- return static_cast<CpuL07Model*>(getModel())
- ->p_hostModel
+ return static_cast<CpuL07Model*>(getModel())->p_hostModel
->executeParallelTask( 1, host_list, flops_amount, bytes_amount, -1);
}
Action *CpuL07::sleep(double duration)
{
- L07Action *action = NULL;
-
- XBT_IN("(%s,%g)", getName(), duration);
-
- action = static_cast<L07Action*>(execute(1.0));
+ L07Action *action = static_cast<L07Action*>(execution_start(1.0));
action->m_maxDuration = duration;
action->m_suspended = 2;
lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), 0.0);
- XBT_OUT();
return action;
}
return lmm_constraint_used(getModel()->getMaxminSystem(), getConstraint());
}
-void CpuL07::updateState(tmgr_trace_iterator_t event_type, double value, double /*date*/){
+void CpuL07::updateState(tmgr_trace_iterator_t triggered, double value, double /*date*/){
XBT_DEBUG("Updating cpu %s (%p) with value %g", getName(), this, value);
- if (event_type == p_speedEvent) {
- m_speedScale = value;
- onSpeedChange();
- if (tmgr_trace_event_free(event_type))
- p_speedEvent = NULL;
- } else if (event_type == p_stateEvent) {
+ if (triggered == p_speedEvent) {
+ m_speedScale = value;
+ onSpeedChange();
+ tmgr_trace_event_unref(&p_speedEvent);
+ } else if (triggered == p_stateEvent) {
if (value > 0)
turnOn();
else
turnOff();
- if (tmgr_trace_event_free(event_type))
- p_stateEvent = NULL;
+ tmgr_trace_event_unref(&p_stateEvent);
} else {
- XBT_CRITICAL("Unknown event ! \n");
- xbt_abort();
+ xbt_die("Unknown event!\n");
}
- return;
}
-void LinkL07::updateState(tmgr_trace_iterator_t event_type, double value, double date) {
+void LinkL07::updateState(tmgr_trace_iterator_t triggered, double value, double date) {
XBT_DEBUG("Updating link %s (%p) with value=%f for date=%g", getName(), this, value, date);
- if (event_type == p_bwEvent) {
+ if (triggered == p_bwEvent) {
updateBandwidth(value, date);
- if (tmgr_trace_event_free(event_type))
- p_bwEvent = NULL;
- } else if (event_type == p_latEvent) {
+ tmgr_trace_event_unref(&p_bwEvent);
+ } else if (triggered == p_latEvent) {
updateLatency(value, date);
- if (tmgr_trace_event_free(event_type))
- p_latEvent = NULL;
- } else if (event_type == p_stateEvent) {
+ tmgr_trace_event_unref(&p_latEvent);
+ } else if (triggered == p_stateEvent) {
if (value > 0)
turnOn();
else
turnOff();
- if (tmgr_trace_event_free(event_type))
- p_stateEvent = NULL;
+ tmgr_trace_event_unref(&p_stateEvent);
} else {
- XBT_CRITICAL("Unknown event ! \n");
- xbt_abort();
+ xbt_die("Unknown event ! \n");
}
- return;
}
double LinkL07::getBandwidth()
int hostNb = p_netcardList->size();
- for (i = 0; i < hostNb; i++) {
- for (j = 0; j < hostNb; j++) {
- xbt_dynar_t route=NULL;
+ 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);
+ if (p_communicationAmount[i * hostNb + j] > 0) {
+ double lat = 0.0;
+ routing_platf->getRouteAndLatency((*p_netcardList)[i], (*p_netcardList)[j],
+ &route, &lat);
- lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
+ lat_current = MAX(lat_current, lat * p_communicationAmount[i * hostNb + j]);
+ }
}
}
}
XBT_OUT();
}
-void L07Action::setMaxDuration(double duration)
-{ /* FIXME: should inherit */
- XBT_IN("(%p,%g)", this, duration);
- m_maxDuration = duration;
- XBT_OUT();
-}
-
-void L07Action::setPriority(double priority)
-{ /* FIXME: should inherit */
- XBT_IN("(%p,%g)", this, priority);
- m_priority = priority;
- XBT_OUT();
-}
-
double L07Action::getRemains()
{
XBT_IN("(%p)", this);