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

Reply via email to