X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/69b85c9e1af02bcf07222b50ffbe83781b6027b2..8e9c7516c266b72ebec5a0f14582932619ddda02:/src/surf/network.c diff --git a/src/surf/network.c b/src/surf/network.c index 8a9c9cef29..86ec1833d7 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -1,6 +1,5 @@ -/* $Id$ */ - -/* Copyright (c) 2004 Arnaud Legrand. All rights reserved. */ +/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010. The SimGrid Team. + * All rights reserved. */ /* 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. */ @@ -23,6 +22,70 @@ double sg_weight_S_parameter = 0.0;/* default value; can be set by model or from double sg_tcp_gamma = 0.0; +/******************************************************************************/ +/* Factors callbacks */ +/******************************************************************************/ +static double constant_latency_factor(double size) +{ + return sg_latency_factor; +} + +static double constant_bandwidth_factor(double size) +{ + return sg_bandwidth_factor; +} + +static double constant_bandwidth_constraint(double rate, double bound, double size) +{ + return rate; +} + +/**********************/ +/* SMPI callbacks */ +/**********************/ +static double smpi_latency_factor(double size) +{ + /* 1 B <= size <= 1 KiB */ + if (size <= 1024.0) { + return 1.0056; + } + + /* 2 KiB <= size <= 32 KiB */ + if (size <= 32768.0) { + return 1.8805; + } + + /* 64 KiB <= size <= 4 MiB */ + return 22.7111; +} + +static double smpi_bandwidth_factor(double size) +{ + /* 1 B <= size <= 1 KiB */ + if (size <= 1024.0) { + return 0.2758; + } + + /* 2 KiB <= size <= 32 KiB */ + if (size <= 32768.0) { + return 0.5477; + } + + /* 64 KiB <= size <= 4 MiB */ + return 0.9359; +} + +static double smpi_bandwidth_constraint(double rate, double bound, double size) +{ + return rate < 0 ? bound : min(bound, rate * smpi_bandwidth_factor(size)); +} + + +static double (*latency_factor_callback)(double) = &constant_latency_factor; +static double (*bandwidth_factor_callback)(double) = &constant_bandwidth_factor; +static double (*bandwidth_constraint_callback)(double, double, double) = &constant_bandwidth_constraint; + + static link_CM02_t net_link_new(char *name, double bw_initial, tmgr_trace_t bw_trace, @@ -382,14 +445,17 @@ static void net_update_resource_state(void *id, static surf_action_t net_communicate(const char *src_name, const char *dst_name, int src, int dst, double size, double rate) { + unsigned int i; + link_CM02_t link; + int failed = 0; surf_action_network_CM02_t action = NULL; + double bandwidth_bound; /* LARGE PLATFORMS HACK: Add a link_CM02_t *link and a int link_nb to network_card_CM02_t. It will represent local links for this node Use the cluster_id for ->id */ xbt_dynar_t route = used_routing->get_route(src, dst); /* LARGE PLATFORMS HACK: total_route_size = route_size + src->link_nb + dst->nb */ - unsigned int i; XBT_IN4("(%s,%s,%g,%g)", src_name, dst_name, size, rate); /* LARGE PLATFORMS HACK: @@ -398,8 +464,6 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name, "You're trying to send data from %s to %s but there is no connection between these two hosts.", src_name, dst_name); - link_CM02_t link; - int failed = 0; xbt_dynar_foreach(route, i, link) { if (link->lmm_resource.state_current == SURF_RESOURCE_OFF) { failed = 1; @@ -415,17 +479,23 @@ static surf_action_t net_communicate(const char *src_name, const char *dst_name, action->latency = 0.0; action->weight = 0.0; + bandwidth_bound = -1.0; xbt_dynar_foreach(route, i, link) { action->latency += link->lat_current; action->weight += link->lat_current + sg_weight_S_parameter / (link->lmm_resource.power.peak * link->lmm_resource.power.scale); + if(bandwidth_bound < 0.0) + bandwidth_bound = (*bandwidth_factor_callback)(size) * (link->lmm_resource.power.peak * link->lmm_resource.power.scale); + else + bandwidth_bound = min(bandwidth_bound, (*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 *= sg_latency_factor; + action->latency *= (*latency_factor_callback)(size); + action->rate = (*bandwidth_constraint_callback)(action->rate, bandwidth_bound, size); /* LARGE PLATFORMS HACK: lmm_variable_new(..., total_route_size) */ @@ -566,6 +636,28 @@ static void surf_network_model_init_internal(void) NULL)); } +/************************************************************************/ +/* New model based on LV08 and experimental results of MPI ping-pongs */ +/************************************************************************/ +void surf_network_model_init_SMPI(const char *filename) +{ + + if (surf_network_model) + return; + surf_network_model_init_internal(); + latency_factor_callback = &smpi_latency_factor; + bandwidth_factor_callback = &smpi_bandwidth_factor; + bandwidth_constraint_callback = &smpi_bandwidth_constraint; + net_define_callbacks(filename); + xbt_dynar_push(model_list, &surf_network_model); + network_solve = lmm_solve; + + xbt_cfg_setdefault_double(_surf_cfg_set,"network/weight_S", 8775); + + update_model_description(surf_network_model_description, + "SMPI", surf_network_model); +} + /************************************************************************/ /* New model based on optimizations discussed during this thesis */ /************************************************************************/