X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/15475b4614f5e32f863ed1f3caf97614ad3eae02..2e53f4785e9a2b365a2e7dd3c4248b96ba79dd4b:/src/surf/network.c?ds=sidebyside diff --git a/src/surf/network.c b/src/surf/network.c index 84cff088b7..88b5075554 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -26,7 +26,6 @@ #undef GENERIC_ACTION #define GENERIC_ACTION(action) action->generic_action - XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, "Logging specific to the SURF network module"); @@ -34,6 +33,15 @@ surf_model_t surf_network_model = NULL; static lmm_system_t network_maxmin_system = NULL; static void (*network_solve) (lmm_system_t) = NULL; +xbt_dynar_t smpi_bw_factor = NULL; +xbt_dynar_t smpi_lat_factor = NULL; + +typedef struct s_smpi_factor *smpi_factor_t; +typedef struct s_smpi_factor { + long factor; + double value; +} s_smpi_factor_t; + double sg_sender_gap = 0.0; double sg_latency_factor = 1.0; /* default value; can be set by model or from command line */ double sg_bandwidth_factor = 1.0; /* default value; can be set by model or from command line */ @@ -98,41 +106,86 @@ static double constant_bandwidth_constraint(double rate, double bound, return rate; } - /**********************/ /* SMPI callbacks */ /**********************/ -static double smpi_latency_factor(double size) +static double smpi_bandwidth_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; + char *value = NULL; + unsigned int iter = 0; + smpi_factor_t fact = NULL; + + if(!smpi_bw_factor){ + xbt_dynar_t radical_elements,radical_elements2 = NULL; + + char *smpi_coef_string = xbt_cfg_get_string(_surf_cfg_set,"smpi/bw_factor"); + smpi_bw_factor = xbt_dynar_new(sizeof(smpi_factor_t),free); + radical_elements = xbt_str_split(smpi_coef_string, ";"); + xbt_dynar_foreach(radical_elements, iter, value) { + + radical_elements2 = xbt_str_split(value, ":"); + if(xbt_dynar_length(radical_elements2) != 2) + xbt_die("Malformed radical for smpi/bw_factor!"); + fact = xbt_new(s_smpi_factor_t,1); + fact->factor = atol(xbt_dynar_get_as(radical_elements2,0,char*)); + fact->value = atof(xbt_dynar_get_as(radical_elements2,1,char*)); + xbt_dynar_push_as(smpi_bw_factor,smpi_factor_t,fact); + XBT_DEBUG("smpi_bandwidth_factor:\t%ld : %f",fact->factor,fact->value); + xbt_dynar_free(&radical_elements2); + } + xbt_dynar_free(&radical_elements); + } + + xbt_dynar_foreach(smpi_bw_factor, iter, fact) { + if(size >= fact->factor) + { + XBT_DEBUG("%lf >= %ld return %f",size,fact->factor,fact->value); + return fact->value; + } + + } + + return 1.0; } -static double smpi_bandwidth_factor(double size) +static double smpi_latency_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; + char *value = NULL; + unsigned int iter = 0; + smpi_factor_t fact = NULL; + + if(!smpi_lat_factor){ + xbt_dynar_t radical_elements,radical_elements2 = NULL; + + char *smpi_coef_string = xbt_cfg_get_string(_surf_cfg_set,"smpi/lat_factor"); + smpi_lat_factor = xbt_dynar_new(sizeof(smpi_factor_t),free); + radical_elements = xbt_str_split(smpi_coef_string, ";"); + xbt_dynar_foreach(radical_elements, iter, value) { + + radical_elements2 = xbt_str_split(value, ":"); + if(xbt_dynar_length(radical_elements2) != 2) + xbt_die("Malformed radical for smpi/lat_factor!"); + fact = xbt_new(s_smpi_factor_t,1); + fact->factor = atol(xbt_dynar_get_as(radical_elements2,0,char*)); + fact->value = atof(xbt_dynar_get_as(radical_elements2,1,char*)); + xbt_dynar_push_as(smpi_lat_factor,smpi_factor_t,fact); + XBT_DEBUG("smpi_latency_factor:\t%ld : %f",fact->factor,fact->value); + xbt_dynar_free(&radical_elements2); + } + xbt_dynar_free(&radical_elements); + } + + xbt_dynar_foreach(smpi_lat_factor, iter, fact) { + if(size >= fact->factor) + { + XBT_DEBUG("%lf >= %ld return %f",size,fact->factor,fact->value); + return fact->value; + } + } + + return 1.0; } +/**--------- -----------*/ static double smpi_bandwidth_constraint(double rate, double bound, double size) @@ -325,6 +378,7 @@ static int net_action_unref(surf_action_t action) static void net_action_cancel(surf_action_t action) { + XBT_DEBUG("cancel action %p",action); surf_network_model->action_state_set(action, SURF_ACTION_FAILED); if(network_update_mechanism == UM_LAZY){// remove action from the heap xbt_swag_remove(action, net_modified_set);