update:

After playing for a little bit, I'm more confused now:
if I have a distributed domain D, and array B declared on D, the following
code 1 will work and 2 will fail in runtime with an error "cannot access
remote data in local block", why is that?
1. work
forall b in B {
    local {
         b = here.locale.id;
    }
}

2. fail
forall d in D {
     local {
          B[d] = here.locale.id;
     }
}



On Mon, Aug 7, 2017 at 1:06 PM, Hui Zhang <[email protected]> wrote:

> Hello,
>
> I have a question about the data distribution in Chapel, for example we
> have:
>
> const D = {1..8} dmapped Block({1..8});
> var B: [D] real;
> forall d in D {
>    var A : 8*real;
>    foo(A, B[d]);
> }
>
> So in multilocale, even though the domain D is distributed,​ the variable
> A declared in each iteration is still allocated on node0 right? which means
> we can not add "local"  clause around the loop body since foo needs to
> access A from other nodes which requires communication, like:
> local {
>     var A: 8*real;
>     foo(A, B[d]);
> }  ​
>
> or
>
> var A: 8*real;
> local {
>      foo(A, B[d]);
> }
>
>
> Further, is it true that the only ways to put data on nodes other than 0
> are:
> 1. use explict "on" clause, everything inside it will be allocated on the
> specific locale
> 2. use distributed domain: piece of the data will be allocated on each
> locale.
> ?
>
> Thanks
> --
> Best regards
>
>
> Hui Zhang
>



-- 
Best regards


Hui Zhang
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Chapel-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/chapel-developers

Reply via email to