freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] Re: [PATCH] Fix ReduceOverContexts


From: Richard Guenther
Subject: Re: [pooma-dev] Re: [PATCH] Fix ReduceOverContexts
Date: Tue, 2 Dec 2003 20:22:37 +0100 (CET)

On Tue, 2 Dec 2003, Jeffrey D. Oldham wrote:

> Richard Guenther wrote:
> > Hi!
> >
> > The following patch fixes ReduceOverContext wrt "invalid" participants of
> > the reduction (I dont think I ever came along these, though...).
> >
> > Seems obviously correct, but it isnt used extensively (only user of the
> > validity argument seems to be Reduction<RemoteMultiPatchEvaluatorTag> and
> > the case of invalidity is not covered in the testsuite).
> >
> > The problem is that if the owning context has an invalid value, we're
> > calling the reduction operator on an uninitialized value. Ugh.
> >
> > Ok?
>
> Yes.  Please correct the spelling noted below.
> >    T value_m;
> > +
> > +  // If its valid.
>
> Will you please change the spelling to:
>
> If it's valid.

Ok, for the record, I committed the patch below which has an additional
typo fixed (s/value_m/me->value_m/) revealed during a compile check.

Richard.

2003Dec02  Richard Guenther <address@hidden>

        * src/Tulip/ReduceOverContexts.h: handle case that reduction context
        has invalid value.

Index: ReduceOverContexts.h
===================================================================
RCS file: /home/pooma/Repository/r2/src/Tulip/ReduceOverContexts.h,v
retrieving revision 1.9
diff -u -u -r1.9 ReduceOverContexts.h
--- ReduceOverContexts.h        21 Oct 2003 18:47:59 -0000      1.9
+++ ReduceOverContexts.h        2 Dec 2003 19:14:00 -0000
@@ -34,7 +34,8 @@
 /** @file
  * @ingroup Tulip
  * @brief
- * Undocumented.
+ * ReduceOverContexts encapsulates functionality like MPI_Reduce
+ * and MPI_Allreduce by means of the ReduceOverContexts::broadcast() method.
  */

 #ifndef POOMA_CHEETAH_REDUCEOVERCONTEXTS_H
@@ -196,11 +197,8 @@
 #if POOMA_CHEETAH

   ReduceOverContexts(const T &val, int toContext = 0, bool valid = true)
-    : toContext_m(toContext)
+    : valid_m(false), toContext_m(toContext)
     {
-      if (valid)
-        value_m = val;
-
       int tagBase = tagBase_m;
       tagBase_m += Pooma::contexts();

@@ -267,9 +265,10 @@
   {
     if (v.valid())
       {
-       if (me->toReceive_m == Pooma::contexts())
+       if (!me->valid_m)
          {
            me->value_m = v.value();
+           me->valid_m = true;
          }
        else
          {
@@ -280,9 +279,13 @@
     me->toReceive_m--;
   }

- // The actual value we're reducing.
+  // The actual value we're reducing.

   T value_m;
+
+  // If it's valid.
+
+  bool valid_m;

   // The number of messages we're receiving.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]