[pooma-dev] Explanation of blockAndEvaluate()

Stephen Smith stephens at proximation.com
Tue Dec 4 20:01:04 UTC 2001


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:oldham at codesourcery.com]
Sent: Tuesday, December 04, 2001 1:43 PM
To: pooma-dev at pooma.codesourcery.com
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20011204/37496bc1/attachment.html>


More information about the pooma-dev mailing list