Example #1
0
/** @brief take into account changes of speed (either load or max) */
void CpuCas01::onSpeedChange() {
  lmm_variable_t var = nullptr;
  lmm_element_t elem = nullptr;

    lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(),
                                coresAmount_ * speed_.scale * speed_.peak);
    while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
      CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));

      lmm_update_variable_bound(getModel()->getMaxminSystem(), action->getVariable(), speed_.scale * speed_.peak);
    }

  Cpu::onSpeedChange();
}
Example #2
0
void NetworkIBModel::computeIBfactors(IBNode *root) {
  double penalized_bw=0.0;
  double num_comm_out = (double) root->ActiveCommsUp.size();
  double max_penalty_out=0.0;
  //first, compute all outbound penalties to get their max
  for (std::vector<ActiveComm*>::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) {
    double my_penalty_out = 1.0;

    if(num_comm_out!=1){
      if((*it)->destination->nbActiveCommsDown > 2)//number of comms sent to the receiving node
	my_penalty_out = num_comm_out * Bs * ys;
      else
	my_penalty_out = num_comm_out * Bs;
    }

    max_penalty_out = max(max_penalty_out,my_penalty_out);
  }

  for (std::vector<ActiveComm*>::iterator it= root->ActiveCommsUp.begin(); it != root->ActiveCommsUp.end(); ++it) {

    //compute inbound penalty
    double my_penalty_in = 1.0;
    int nb_comms = (*it)->destination->nbActiveCommsDown;//total number of incoming comms
    if(nb_comms!=1)
      my_penalty_in = ((*it)->destination->ActiveCommsDown)[root] //number of comm sent to dest by root node
		      * Be 
		      * (*it)->destination->ActiveCommsDown.size();//number of different nodes sending to dest
    
    double penalty=max(my_penalty_in,max_penalty_out);
    
    double rate_before_update = (*it)->action->getBound();
    //save initial rate of the action
    if((*it)->init_rate==-1) 
      (*it)->init_rate= rate_before_update;
    
    penalized_bw= ! num_comm_out ? (*it)->init_rate : (*it)->init_rate /penalty;
    
    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);
    }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 );
    }

  }
  XBT_DEBUG("Finished computing IB penalties");
}