While I am sympathetic to the desire to reduce typing, I think a potential 
drawback of this approach is that it would make task/forall intents more 
different than function intents.  Specifically, in the function context:

        proc foo(in x, y) { ... }

says that 'x' is passed in by 'copy in' intent while 'y' is passed by the 
default itent for its type.  It would seem odd to me to have distinct 
interpretations in these two contexts.


A few other notes:

* there isn't a reduce intent for the function call context, so arguably
   it would be OK to do something different for it in the task/forall
   context.

* I can't recall whether there is a default/blank intent for the
   task/forall context currenetly.  If there is, it doesn't add any value
   per se (since anything not listed in the 'with' clause will be passed by
   default intent since "passing" is via scoping in this context.  All the
   same, it might be weird to have the lack of an intent mean one thing in
   the function context and a completely different thing in the forall/task
   context)

-Brad



On Tue, 28 Feb 2017, Nicholas Park wrote:

> 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

Reply via email to