X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/08ac8cf29005a988b7d8e8cc37223a60ab661f08..c9120b61ec798b29e09f03c9fad3cea6704e0435:/src/surf/network.c diff --git a/src/surf/network.c b/src/surf/network.c index 634c897839..d9afd7be6e 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -26,7 +26,7 @@ double sg_bandwidth_factor = 1.0; /* default value; can be set by model or double sg_weight_S_parameter = 0.0; /* default value; can be set by model or from command line */ double sg_tcp_gamma = 0.0; -int sg_network_fullduplex = 0; +int sg_network_crosstraffic = 0; xbt_dict_t gap_lookup = NULL; @@ -40,7 +40,7 @@ static void gap_append(double size, const link_CM02_t link, surf_action_network_ if(sg_sender_gap > 0.0) { if(!gap_lookup) { - gap_lookup = xbt_dict_new(); + gap_lookup = xbt_dict_new_homogeneous(NULL); } fifo = (xbt_fifo_t)xbt_dict_get_or_null(gap_lookup, src); action->sender.gap = 0.0; @@ -81,7 +81,7 @@ static void gap_remove(surf_action_network_CM02_t action) { if(size == 0) { xbt_fifo_free(fifo); xbt_dict_remove(gap_lookup, action->sender.link_name); - size = xbt_dict_size(gap_lookup); + size = xbt_dict_length(gap_lookup); if(size == 0) { xbt_dict_free(&gap_lookup); } @@ -318,8 +318,7 @@ static int net_action_unref(surf_action_t action) #ifdef HAVE_TRACING xbt_free(((surf_action_network_CM02_t) action)->src_name); xbt_free(((surf_action_network_CM02_t) action)->dst_name); - if (action->category) - xbt_free(action->category); + xbt_free(action->category); #endif surf_action_free(&action); return 1; @@ -414,8 +413,8 @@ static void net_update_actions_state(double now, double delta) } #ifdef HAVE_TRACING if (TRACE_is_enabled()) { - xbt_dynar_t route = global_routing->get_route(action->src_name, - action->dst_name); + xbt_dynar_t route=NULL; + routing_get_route_and_latency(action->src_name, action->dst_name,&route,NULL); link_CM02_t link; unsigned int i; xbt_dynar_foreach(route, i, link) { @@ -586,12 +585,13 @@ static surf_action_t net_communicate(const char *src_name, xbt_dynar_t back_route = NULL; int constraints_per_variable = 0; - xbt_dynar_t route; - // I will need this route for some time so require for no cleanup - global_routing->get_route_latency(src_name, dst_name, &route, &latency, 0); + xbt_dynar_t route = xbt_dynar_new(sizeof(void*),NULL); + // I need to have the forward and backward routes at the same time, so allocate "route". That way, the routing wont clean it up + routing_get_route_and_latency(src_name, dst_name, &route, &latency); - if (sg_network_fullduplex == 1) { - back_route = global_routing->get_route(dst_name, src_name); + if (sg_network_crosstraffic == 1) { + // FIXME: fill route directly + routing_get_route_and_latency(dst_name, src_name, &back_route,NULL); } /* LARGE PLATFORMS HACK: @@ -600,7 +600,7 @@ static surf_action_t net_communicate(const char *src_name, XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate); /* LARGE PLATFORMS HACK: assert on total_route_size */ - xbt_assert(xbt_dynar_length(route) || latency, + xbt_assert(!xbt_dynar_is_empty(route) || latency, "You're trying to send data from %s to %s but there is no connection at all between these two hosts.", src_name, dst_name); @@ -629,24 +629,24 @@ static surf_action_t net_communicate(const char *src_name, (link->lmm_resource.power.peak * link->lmm_resource.power.scale); if (bandwidth_bound < 0.0) bandwidth_bound = - (*bandwidth_factor_callback) (size) * + bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale); else bandwidth_bound = min(bandwidth_bound, - (*bandwidth_factor_callback) (size) * + bandwidth_factor_callback(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale)); } /* LARGE PLATFORMS HACK: Add src->link and dst->link latencies */ action->lat_current = action->latency; - action->latency *= (*latency_factor_callback) (size); + action->latency *= latency_factor_callback(size); action->rate = - (*bandwidth_constraint_callback) (action->rate, bandwidth_bound, + bandwidth_constraint_callback(action->rate, bandwidth_bound, size); - if(xbt_dynar_length(route) > 0) { + if(!xbt_dynar_is_empty(route)) { link = *(link_CM02_t*)xbt_dynar_get_ptr(route, 0); gap_append(size, link, action); XBT_DEBUG("Comm %p: %s -> %s gap=%f (lat=%f)", @@ -698,7 +698,7 @@ static surf_action_t net_communicate(const char *src_name, action->variable, 1.0); } - if (sg_network_fullduplex == 1) { + if (sg_network_crosstraffic == 1) { XBT_DEBUG("Fullduplex active adding backward flow using 5%c", '%'); xbt_dynar_foreach(back_route, i, link) { lmm_expand(network_maxmin_system, link->lmm_resource.constraint, @@ -724,7 +724,9 @@ static surf_action_t net_communicate(const char *src_name, static xbt_dynar_t net_get_route(const char *src, const char *dst) { - return global_routing->get_route(src, dst); + xbt_dynar_t route=NULL; + routing_get_route_and_latency(src, dst,&route, NULL); + return route; } static double net_get_link_bandwidth(const void *link) @@ -786,8 +788,6 @@ static void net_finalize(void) surf_model_exit(surf_network_model); surf_network_model = NULL; - global_routing->finalize(); - lmm_system_free(network_maxmin_system); network_maxmin_system = NULL; } @@ -840,8 +840,7 @@ static void surf_network_model_init_internal(void) 498000000, NULL, 0.000015, NULL, SURF_RESOURCE_ON, NULL, - SURF_LINK_FATPIPE, NULL), - net_get_link_latency); + SURF_LINK_FATPIPE, NULL)); } @@ -865,8 +864,6 @@ void surf_network_model_init_SMPI(void) xbt_cfg_setdefault_double(_surf_cfg_set, "network/sender_gap", 10e-6); xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775); - update_model_description(surf_network_model_description, - "SMPI", surf_network_model); } /************************************************************************/ @@ -887,8 +884,6 @@ void surf_network_model_init_LegrandVelho(void) 0.92); xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775); - update_model_description(surf_network_model_description, - "LV08_fullupdate", surf_network_model); } /***************************************************************************/ @@ -911,9 +906,6 @@ void surf_network_model_init_CM02(void) net_define_callbacks(); xbt_dynar_push(model_list, &surf_network_model); network_solve = lmm_solve; - - update_model_description(surf_network_model_description, - "CM02", surf_network_model); } void surf_network_model_init_Reno(void) @@ -932,9 +924,6 @@ void surf_network_model_init_Reno(void) xbt_cfg_setdefault_double(_surf_cfg_set, "network/bandwidth_factor", 0.92); xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775); - - update_model_description(surf_network_model_description, - "Reno", surf_network_model); } @@ -955,9 +944,6 @@ void surf_network_model_init_Reno2(void) 0.92); xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S_parameter", 8775); - - update_model_description(surf_network_model_description, - "Reno2", surf_network_model); } void surf_network_model_init_Vegas(void) @@ -976,7 +962,4 @@ void surf_network_model_init_Vegas(void) xbt_cfg_setdefault_double(_surf_cfg_set, "network/bandwidth_factor", 0.92); xbt_cfg_setdefault_double(_surf_cfg_set, "network/weight_S", 8775); - - update_model_description(surf_network_model_description, - "Vegas", surf_network_model); }