I think it makes an immutable copy of the variables in the scope of the 
coforall as an intent. If you tried to assign to x or r in your coforall you'd 
get an lvalue assignment error.

> On Jun 10, 2016, at 4:36 PM, Nikhil Padmanabhan 
> <[email protected]> wrote:
> 
> Hi ---
> 
> I'm misunderstanding something about locales -- consider the following 
> program :
> 
> record R {
>   var x : int;
> }
> 
> proc main() {
>   var r : R;
>   var x : int;
>   writeln("-----");
>   for loc in Locales do on loc {
>     writeln('X :',x.locale);
>     writeln('R :',r.locale);
>   }
>   writeln("-----");
>   coforall loc in Locales do on loc {
>     writeln('X :',x.locale);
>     writeln('R :',r.locale);
>   }
> }
> 
> $ ./a.out -nl 2
> -----
> X :LOCALE0
> R :LOCALE0
> X :LOCALE0
> R :LOCALE0
> -----
> X :LOCALE0
> R :LOCALE0
> X :LOCALE1
> R :LOCALE1
> 
> So --- the for and coforall have very different behaviors regarding locales, 
> which surprised me. I'm guessing this is because coforall makes a copy (to 
> avoid races on X and R) while for doesn't....
> 
> Is this behavior intentional?
> 
> Thanks!
> -- Nikhil
> 
> 
> 
> 
> ---------------------------------
> Nikhil Padmanabhan
> [email protected]
> ------------------------------------------------------------------------------
> What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
> patterns at an interface-level. Reveals which users, apps, and protocols are 
> consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
> J-Flow, sFlow and other flows. Make informed decisions using capacity 
> planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
> _______________________________________________
> Chapel-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/chapel-users
------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Chapel-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-users

Reply via email to