From 9895833fa0f517aaacce17e6be71e1ca0f0fdead Mon Sep 17 00:00:00 2001 From: eschnett Date: Wed, 30 Mar 2011 19:22:41 +0000 Subject: TimerReport requires that all timers exist on all processes. If there is an inconsistency, TimerReport aborts with an error. This patch improves the error message by including the number of timers as well, so that one sees which process is in error. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/TimerReport/trunk@39 d0051148-8e13-4bef-be1d-f6c572c85f9f --- src/Output.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Output.c b/src/Output.c index c69f415..5f734f6 100644 --- a/src/Output.c +++ b/src/Output.c @@ -617,7 +617,10 @@ static void PrintTopTimers (CCTK_ARGUMENTS) return; } -static int integer_same_on_all_procs(cGH const * restrict const cctkGH, const CCTK_INT i) +static int integer_same_on_all_procs(cGH const * restrict const cctkGH, + const CCTK_INT i, + CCTK_INT* restrict const iminp, + CCTK_INT* restrict const imaxp) { /* There is no "equals" reduction operator, so we check that * minimum and maximum are the same */ @@ -633,6 +636,8 @@ static int integer_same_on_all_procs(cGH const * restrict const cctkGH, const CC if (CCTK_ReduceLocScalar(cctkGH, -1 /* All processors */, reduce_max, &i, &max_i, CCTK_VARIABLE_INT)) CCTK_WARN (CCTK_WARN_ABORT, "Error in calling max reduction operator"); + if (iminp) *iminp = min_i; + if (imaxp) *imaxp = max_i; return min_i == max_i; } @@ -649,11 +654,12 @@ static int CollectTimerInfo (cGH const * restrict const cctkGH, assert (timers->ntimers >= 0); /* Check that the number of timers is consistent across processors */ - if (!integer_same_on_all_procs(cctkGH, timers->ntimers)) + CCTK_INT imin, imax; + if (!integer_same_on_all_procs(cctkGH, timers->ntimers, &imin, &imax)) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "Number of timers is inconsistent across processes; cannot collect timer information. Number of timers on processor %d: %d", - CCTK_MyProc(cctkGH), timers->ntimers); + "Number of timers is inconsistent across processes; cannot collect timer information. Number of timers on processor %d: %d; overall minimum: %d; overall maximum: %d", + CCTK_MyProc(cctkGH), timers->ntimers, (int)imin, (int)imax); return 0; } -- cgit v1.2.3