Hi Nikhil,
I think this would be a nice simplification, and I'd suggest expanding it
to all task intents; e.g.,
> var x = 42, y = 29;
>
forall i in 1..10 with (in x, y) { // instead of (in x, in y)
>
x += 2*i;
>
y += 3*i;
>
}
>
I think the programmer's intent (no pun intended) is still clear in this
syntax.
Thanks,
Nick
On Mon, Feb 27, 2017 at 5:42 PM, Nikhil Padmanabhan <
[email protected]> wrote:
> Dear chapel-developers,
>
> I often find myself doing multiple reductions of the same type in forall
> loops (eg. multiple accumulators). The way I currently do this is to
> specify separate reduce intents (as in the commented line in the code
> below....)
> (+ reduce sum1, + reduce sum2)
>
> While this works fine, it would be nice to write this as
>
> (+ reduce sum1,sum2)
>
> or something like that (with a different delimiter, for instance).
>
> I'll note that OpenMP allows specifying such common reductions over a list
> of variables.
>
> Any thoughts?
>
> Thanks in advance,
> -- Nikhil
>
> ------------------------------------------------
>
> var sum1, sum2 = 0;
>
> config const N=100000;
>
> forall ii in 1..N with (+ reduce sum1,sum2) {
> //forall ii in 1..N with (+ reduce sum1, + reduce sum2) {
> sum1 += ii;
> sum2 += ii*ii;
> }
>
> writeln(sum1);
> writeln(sum2);
>
>
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> Chapel-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-users
>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users