/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
-#include <algorithm>
#include <utility>
#include "network_ib.hpp"
static int id=0;
// pour t->id -> rajouter une nouvelle struct dans le dict, pour stocker les comms actives
- if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
+ if(((NetworkIBModel*)surf_network_model)->active_nodes==nullptr)
((NetworkIBModel*)surf_network_model)->active_nodes=xbt_dict_new();
IBNode* act = new IBNode(id);
id++;
xbt_dict_set(((NetworkIBModel*)surf_network_model)->active_nodes,
- host.name().c_str(), act, NULL);
+ host.name().c_str(), act, nullptr);
}
static void IB_action_init_callback(
- simgrid::surf::NetworkAction *action, simgrid::surf::NetCard *src, simgrid::surf::NetCard *dst)
+ simgrid::surf::NetworkAction *action, simgrid::routing::NetCard *src, simgrid::routing::NetCard *dst)
{
simgrid::surf::NetworkIBModel* ibModel = (simgrid::surf::NetworkIBModel*)surf_network_model;
networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback);
Link::onCommunicate.connect(IB_action_init_callback);
simgrid::s4u::Host::onCreation.connect(IB_create_host_callback);
- xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775);
+ xbt_cfg_setdefault_double("network/weight-S", 8775);
}
NetworkIBModel::NetworkIBModel()
: NetworkSmpiModel() {
haveGap_=false;
- active_nodes=NULL;
+ active_nodes=nullptr;
- const char* IB_factors_string=sg_cfg_get_string("smpi/IB_penalty_factors");
+ const char* IB_factors_string=xbt_cfg_get_string("smpi/IB-penalty-factors");
xbt_dynar_t radical_elements = xbt_str_split(IB_factors_string, ";");
surf_parse_assert(xbt_dynar_length(radical_elements)==3,
- "smpi/IB_penalty_factors should be provided and contain 3 elements, semi-colon separated : for example 0.965;0.925;1.35");
+ "smpi/IB-penalty-factors should be provided and contain 3 elements, semi-colon separated. Example: 0.965;0.925;1.35");
- Be = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 0, char *), "First part of smpi/IB_penalty_factors is not numerical: %s");
- Bs = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 1, char *), "Second part of smpi/IB_penalty_factors is not numerical: %s");
- ys = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 2, char *), "Third part of smpi/IB_penalty_factors is not numerical: %s");
+ Be = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 0, char *), "First part of smpi/IB-penalty-factors is not numerical: %s");
+ Bs = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 1, char *), "Second part of smpi/IB-penalty-factors is not numerical: %s");
+ ys = xbt_str_parse_double(xbt_dynar_get_as(radical_elements, 2, char *), "Third part of smpi/IB-penalty-factors is not numerical: %s");
xbt_dynar_free(&radical_elements);
}
NetworkIBModel::~NetworkIBModel()
{
- xbt_dict_cursor_t cursor = NULL;
- IBNode* instance = NULL;
- char *name = NULL;
+ xbt_dict_cursor_t cursor = nullptr;
+ IBNode* instance = nullptr;
+ char *name = nullptr;
xbt_dict_foreach(active_nodes, cursor, name, instance)
delete instance;
xbt_dict_free(&active_nodes);
return;
bool* updated=(bool*)xbt_malloc0(xbt_dict_size(active_nodes)*sizeof(bool));
- ActiveComm* comm=NULL;
+ ActiveComm* comm=nullptr;
if(remove){
if(to->ActiveCommsDown[from]==1)
to->ActiveCommsDown.erase(from);