From 0541e4c5f26c349751e57e7e499ff35c38962a57 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Thu, 31 Oct 2013 21:24:38 +0100 Subject: [PATCH 1/1] A value of -1 for smpi/cpu_threshold means infinity. --- src/simgrid/sg_config.c | 2 +- src/smpi/smpi_bench.c | 6 +++--- src/smpi/smpi_global.c | 10 ++++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/simgrid/sg_config.c b/src/simgrid/sg_config.c index b57bc229c1..58f791d43a 100644 --- a/src/simgrid/sg_config.c +++ b/src/simgrid/sg_config.c @@ -698,7 +698,7 @@ void sg_config_init(int *argc, char **argv) xbt_cfg_setdefault_boolean(_sg_cfg_set, "smpi/use_shared_malloc", "yes"); xbt_cfg_register(&_sg_cfg_set, "smpi/cpu_threshold", - "Minimal computation time (in seconds) not discarded.", + "Minimal computation time (in seconds) not discarded, or -1 for infinity.", xbt_cfgelm_double, 1, 1, NULL, NULL); xbt_cfg_setdefault_double(_sg_cfg_set, "smpi/cpu_threshold", 1e-6); diff --git a/src/smpi/smpi_bench.c b/src/smpi/smpi_bench.c index aed281c3ef..7769404296 100644 --- a/src/smpi/smpi_bench.c +++ b/src/smpi/smpi_bench.c @@ -130,7 +130,7 @@ void smpi_execute_flops(double flops) { smx_action_t action; smx_host_t host; host = SIMIX_host_self(); - XBT_DEBUG("Handle real computation time: %f flops", flops); + XBT_DEBUG("Handle real computation time: %g flops", flops); action = simcall_host_execute("computation", host, flops, 1); #ifdef HAVE_TRACING simcall_set_category (action, TRACE_internal_smpi_get_category()); @@ -141,7 +141,7 @@ void smpi_execute_flops(double flops) { static void smpi_execute(double duration) { if (duration >= smpi_cpu_threshold) { - XBT_DEBUG("Sleep for %f to handle real computation time", duration); + XBT_DEBUG("Sleep for %g to handle real computation time", duration); double flops = duration * smpi_running_power; #ifdef HAVE_TRACING int rank = smpi_process_index(); @@ -157,7 +157,7 @@ static void smpi_execute(double duration) #endif } else { - XBT_DEBUG("Real computation took %f while option smpi/cpu_threshold is set to %f => ignore it", + XBT_DEBUG("Real computation took %g while option smpi/cpu_threshold is set to %g => ignore it", duration, smpi_cpu_threshold); } } diff --git a/src/smpi/smpi_global.c b/src/smpi/smpi_global.c index d66190789d..718d079bed 100644 --- a/src/smpi/smpi_global.c +++ b/src/smpi/smpi_global.c @@ -4,10 +4,6 @@ /* 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. */ -#include -#include -#include - #include "private.h" #include "smpi_mpi_dt_private.h" #include "mc/mc.h" @@ -15,6 +11,10 @@ #include "simix/smx_private.h" #include "simgrid/sg_config.h" +#include // DBL_MAX +#include +#include +#include XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_kernel, smpi, "Logging specific to SMPI (kernel)"); @@ -467,6 +467,8 @@ int smpi_main(int (*realmain) (int argc, char *argv[]),int argc, char *argv[]) smpi_cpu_threshold = sg_cfg_get_double("smpi/cpu_threshold"); smpi_running_power = sg_cfg_get_double("smpi/running_power"); + if (smpi_cpu_threshold < 0) + smpi_cpu_threshold = DBL_MAX; smpi_global_init(); -- 2.20.1