aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2003-07-14 08:27:20 +0000
committertradke <tradke@ebee0441-1374-4afa-a3b5-247f3ba15b9a>2003-07-14 08:27:20 +0000
commitf24dce70a7cd3a91916e86e326a02d7ebfe9798b (patch)
tree294d256bd1b46174b0abc2438223a8cf0bd841fc /src
parent6a1111e3fa4879761463aec65492bc8cc87c29f2 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/DumpVar.c43
1 files changed, 27 insertions, 16 deletions
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);
+ }
}
}