From f24dce70a7cd3a91916e86e326a02d7ebfe9798b Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 14 Jul 2003 08:27:20 +0000 Subject: Better wording in warning message which is issued if the reduction operation failed while dumping the value of a grid scalar during a multiprocessor run. This closes BetaThorns/1564. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOFlexIO/trunk@281 ebee0441-1374-4afa-a3b5-247f3ba15b9a --- src/DumpVar.c | 43 +++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) (limited to 'src') diff --git a/src/DumpVar.c b/src/DumpVar.c index 117bf5f..d57b6ac 100644 --- a/src/DumpVar.c +++ b/src/DumpVar.c @@ -222,26 +222,37 @@ static int WriteGS (const cGH *GH, const ioRequest *request, IOFile file) CCTK_VarDataPtrI (GH, request->timelevel, request->vindex), hdatatypesize); - i = CCTK_ReductionHandle ("sum"); - if (CCTK_ReduceArray (GH, -1, i, nprocs, request->hdatatype, - buffer, 1, 1, request->hdatatype, nprocs, buffer)) + if (nprocs > 1) { - CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "WriteGS: Failed to reduce grid scalar '%s'", fullname); - } - else - { - retval = 0; - for (i = 1; i < nprocs; i++) - { - retval |= memcmp (buffer, buffer + i*hdatatypesize, hdatatypesize); + i = CCTK_ReductionHandle ("sum"); + if (i >= 0) + { + i = CCTK_ReduceArray (GH, -1, i, nprocs, request->hdatatype, + buffer, 1, 1, request->hdatatype, nprocs, buffer); } - if (retval) + if (i < 0) { CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, - "WriteGS: value of grid scalar variable '%s' (timelevel %d) " - "differs between processors, only value from processor 0 " - "will be written", fullname, request->timelevel); + "WriteGS: Cannot check whether values on different " + "processors are the same for grid scalar '%s'", fullname); + + /* copy this processor's value to the start of buffer */ + memcpy (buffer, buffer + myproc*hdatatypesize, hdatatypesize); + } + else + { + retval = 0; + for (i = 1; i < nprocs; i++) + { + retval |= memcmp (buffer, buffer + i*hdatatypesize, hdatatypesize); + } + if (retval) + { + CCTK_VWarn (1, __LINE__, __FILE__, CCTK_THORNSTRING, + "WriteGS: value of grid scalar variable '%s' (timelevel %d)" + " differs between processors, only value from processor 0 " + "will be written", fullname, request->timelevel); + } } } -- cgit v1.2.3