freepooma-devel
[Top][All Lists]
Advanced

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

RE: [pooma-dev] Explanation of blockAndEvaluate()


From: Stephen Smith
Subject: RE: [pooma-dev] Explanation of blockAndEvaluate()
Date: Tue, 4 Dec 2001 13:01:04 -0700

Actually, Jim pointed out a problem with one of the examples.
I was trying to come up with an example where code that doesn't
need to be evaluated can occur between blockAndEvaluate and some
serial code.  You want everything that reads as
well as writes to a given array to be done before you change
it, and I missed one of the dependencies.

-----Original Message-----
From: Jeffrey Oldham [mailto:address@hidden]
Sent: Tuesday, December 04, 2001 1:43 PM
To: address@hidden
Subject: [pooma-dev] Explanation of blockAndEvaluate()
 
> 1: a = b;
> 2: c = a;
>    blockAndEvaluate();
> 3: e = c;
> 4: c(5) = 7;
> 5: d = c + e;
>    blockAndEvaluate();
> 6: cout << d(5) << d(3) << endl;

this isn't quite correct because statement 3 reads from c and
statement 4 could occur before statement 3.  The following example
is correct:

1: a = b;
2: c = a;
   blockAndEvaluate();
3: e = b;
4: c(5) = 7;
5: d = c + e;
   blockAndEvaluate();
6: cout << d(5) << d(3) << endl;

It's tricky to figure out, which is why it's best to just put
blockAndEvaluate() immediately before all blocks of serial access,
if you want code that is pretty close to optimal and guaranteed to
be correct.

    Stephen


reply via email to

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