From: Arnaud Giersch Date: Thu, 31 Oct 2013 20:24:12 +0000 (+0100) Subject: Cache cfg parameters smpi/{cpu_threshold,running_power}. X-Git-Tag: v3_10_rc1~23 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/afce8d5e39f2887c03cbc16b84e563cb5d69328a Cache cfg parameters smpi/{cpu_threshold,running_power}. --- diff --git a/src/smpi/private.h b/src/smpi/private.h index 03fdd13352..9ea8fb41d6 100644 --- a/src/smpi/private.h +++ b/src/smpi/private.h @@ -288,6 +288,8 @@ int smpi_coll_basic_alltoallv(void *sendbuf, int *sendcounts, MPI_Comm comm); // utilities +extern double smpi_cpu_threshold; +extern double smpi_running_power; extern int smpi_sample_is_running; void smpi_bench_destroy(void); void smpi_bench_begin(void); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index 480c391f52..aed281c3ef 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -66,6 +66,9 @@ xbt_dict_t samples = NULL; /* Allocated on first use */ xbt_dict_t calls = NULL; /* Allocated on first use */ __thread int smpi_current_rank = 0; /* Updated after each MPI call */ +double smpi_cpu_threshold; +double smpi_running_power; + typedef struct { int fd; int count; @@ -137,11 +140,9 @@ void smpi_execute_flops(double flops) { static void smpi_execute(double duration) { - /* FIXME: a global variable would be less expensive to consult than a call to xbt_cfg_get_double() right on the critical path */ - if (duration >= sg_cfg_get_double("smpi/cpu_threshold")) { + if (duration >= smpi_cpu_threshold) { XBT_DEBUG("Sleep for %f to handle real computation time", duration); - double flops = duration * - sg_cfg_get_double("smpi/running_power"); + double flops = duration * smpi_running_power; #ifdef HAVE_TRACING int rank = smpi_process_index(); instr_extra_data extra = xbt_new0(s_instr_extra_data_t,1); @@ -152,12 +153,12 @@ static void smpi_execute(double duration) smpi_execute_flops(flops); #ifdef HAVE_TRACING - TRACE_smpi_computing_out(rank); + TRACE_smpi_computing_out(rank); #endif } else { XBT_DEBUG("Real computation took %f while option smpi/cpu_threshold is set to %f => ignore it", - duration, sg_cfg_get_double("smpi/cpu_threshold")); + duration, smpi_cpu_threshold); } } diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index 4ebd97af96..d66190789d 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -465,6 +465,9 @@ int smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]) mpi_coll_barrier_fun = (int (*)(MPI_Comm comm)) mpi_coll_barrier_description[barrier_id].coll; + smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold"); + smpi_running_power = sg_cfg_get_double("smpi/running_power"); + smpi_global_init(); /* Clean IO before the run */