From 79a0e7d2c82c1d2220c1c82165beef46a4cf67ce Mon Sep 17 00:00:00 2001 From: Augustin Degomme Date: Mon, 11 Feb 2013 18:27:33 +0100 Subject: [PATCH] add an smpi/ois factor, to account for the fact that MPI_Send and MPI_Isend internal times may be differents --- src/simgrid/sg_config.c | 8 +++++++- src/smpi/smpi_base.c | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index 5a6faa9fa5..1bd37aecca 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -687,11 +687,17 @@ void sg_config_init(int *argc, char **argv) xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/lat_factor", "65472:11.6436;15424:3.48845;9376:2.59299;5776:2.18796;3484:1.88101;1426:1.61075;732:1.9503;257:1.95341;0:2.01467"); xbt_cfg_register(&_sg_cfg_set, "smpi/os", - "Small messages timings (MPI_Isend/Send minimum time for small messages)", + "Small messages timings (MPI_Send minimum time for small messages)", xbt_cfgelm_string, NULL, 1, 1, NULL, NULL); xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/os", "1:0:0:0:0"); + xbt_cfg_register(&_sg_cfg_set, "smpi/ois", + "Small messages timings (MPI_Isend minimum time for small messages)", + xbt_cfgelm_string, NULL, 1, 1, NULL, + NULL); + xbt_cfg_setdefault_string(_sg_cfg_set, "smpi/ois", "1:0:0:0:0"); + xbt_cfg_register(&_sg_cfg_set, "smpi/or", "Small messages timings (MPI_Recv minimum time for small messages)", xbt_cfgelm_string, NULL, 1, 1, NULL, diff --git a/src/smpi/smpi_base.c b/src/smpi/smpi_base.c index 9cb7054e0d..9e48e3cd50 100644 --- a/src/smpi/smpi_base.c +++ b/src/smpi/smpi_base.c @@ -68,7 +68,7 @@ typedef struct s_smpi_factor { } s_smpi_factor_t; xbt_dynar_t smpi_os_values = NULL; xbt_dynar_t smpi_or_values = NULL; - +xbt_dynar_t smpi_ois_values = NULL; // Methods used to parse and store the values for timing injections in smpi // These are taken from surf/network.c and generalized to have more factors @@ -139,6 +139,28 @@ static double smpi_os(double size) return current; } +static double smpi_ois(double size) +{ + if (!smpi_ois_values) + smpi_ois_values = + parse_factor(sg_cfg_get_string("smpi/ois")); + + unsigned int iter = 0; + s_smpi_factor_t fact; + double current=0.0; + xbt_dynar_foreach(smpi_ois_values, iter, fact) { + if (size <= fact.factor) { + XBT_DEBUG("ois : %lf <= %ld return %f", size, fact.factor, current); + return current; + }else{ + current=fact.values[0]+fact.values[1]*size; + } + } + XBT_DEBUG("ois : %lf > %ld return %f", size, fact.factor, current); + + return current; +} + static double smpi_or(double size) { if (!smpi_or_values) @@ -339,7 +361,14 @@ void smpi_mpi_start(MPI_Request request) // we make a copy here, as the size is modified by simix, and we may reuse the request in another receive later request->real_size=request->size; smpi_datatype_use(request->old_type); - double sleeptime = smpi_os(request->size); + + //if we are giving back the control to the user without waiting for completion, we have to inject timings + double sleeptime =0.0; + if(request->detached && !(request->flags & ISEND)) + sleeptime = smpi_os(request->size); + else + sleeptime = smpi_ois(request->size); + if(sleeptime!=0.0){ simcall_process_sleep(sleeptime); XBT_DEBUG("sending size of %zu : sleep %lf ", request->size, smpi_os(request->size)); -- 2.20.1