Correct, this has not been fully implemented yet.
What is working currently is if in the 'forall' instead of '1..n' you
use myiter() and define it, for example, like this:
// serial
iter myiter() {
for i in 1..n do
yield i;
}
// parallel standalone
iter myiter(param tag) where tag == iterKind.standalone {
const NC = here.numCores;
coforall i in 1..NC do
for j in i..n by NC do
yield j;
}
BTW another correction: currently when using reduce intents, the
parallel-safe accumulation of thread-private variables onto the global
result is done with sync variables, not atomics. We plan to address both
these issues.
Vassily
On 07/23/15 04:23, Russel Winder wrote:
> On Wed, 2015-07-22 at 13:50 -0700, Vassily Litvinov wrote:
>>
> […]
>> On 07/22/15 11:56, Russel Winder wrote:
>>>
> […]
>>> var sum: sync real = 0.0;
>>> forall i in 1..n do { sum += 1.0 / (1.0 + ((i - 0.5) * delta) **
>>> 2);
>>> }
>>> const pi = 4.0 * delta * sum;
>>>
>>> ?
>
> I just tried:
>
> var sum: real = 0.0;
> forall i in 1..n with (+ reduce sum) { sum += 1.0 / (1.0 + ((i - 0.5)
> * delta) ** 2); }
> const pi = 4.0 * delta * sum;
>
> but got the error:
>
> $CHPL_HOME/modules/internal/ChapelRange.chpl:1299: In iterator 'these':
> $CHPL_HOME/modules/internal/ChapelRange.chpl:1322: error: yields
> outside of task constructs in the leader or standalone iterator are not
> supported with reduce intents
>
> Does this mean I am not up to date enough (I am using master from the
> Git repository), or is this not working as yet?
>
------------------------------------------------------------------------------
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users