From: Augustin Degomme Date: Wed, 26 Sep 2012 12:54:42 +0000 (+0200) Subject: sort latency and bandwidth value submitted in config files for smpi, before using... X-Git-Tag: v3_8~146^2~22 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/2c4b9b084f2dfb0b9e34bee11e1bc012ea13ad95 sort latency and bandwidth value submitted in config files for smpi, before using them (If the user did provide them sorted from bigger to smaller sizes, only the first and biggest value was being used) --- diff --git a/src/surf/network.c b/src/surf/network.c index d5b647e697..ed1db7b010 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -77,6 +77,13 @@ static double constant_bandwidth_constraint(double rate, double bound, /**********************/ /* SMPI callbacks */ /**********************/ + +static int factor_cmp(const void *pa, const void *pb) +{ + return (((s_smpi_factor_t*)pa)->factor > ((s_smpi_factor_t*)pb)->factor); +} + + static xbt_dynar_t parse_factor(const char *smpi_coef_string) { char *value = NULL; @@ -98,6 +105,12 @@ static xbt_dynar_t parse_factor(const char *smpi_coef_string) xbt_dynar_free(&radical_elements2); } xbt_dynar_free(&radical_elements); + iter=0; + xbt_dynar_sort(smpi_factor, &factor_cmp); + xbt_dynar_foreach(smpi_factor, iter, fact) { + XBT_DEBUG("ordered smpi_factor:\t%ld : %f", fact.factor, fact.value); + + } return smpi_factor; }