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?
No, it should not be. By default, variables are allocated where their
task is currently running, so for a 'forall' over a distributed domain
like this in which the implementing tasks are spread across multiple
locales, each declaration of 'A' should be local to that task's locale.
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]);
}
The 'local' clause is a bit funny sometimes, so I'm nervous about saying
what should or should not work here, but I believe that 'A' should not
break the locality clause (and intuitively, 'B[d]' shouldn't either).
1. use explict "on" clause, everything inside it will be allocated on the
specific locale
Depending on what you mean by 'explicit', yes. 'Implicit' on-clauses (ones
not visible in the source code like those used to implement the forall
loop above) can also have this effect.
2. use distributed domain: piece of the data will be allocated on each
locale.
?
Yes, though under the covers, all distributed domains/arrays are really
using on-clauses as well. So really, explicit and implicit on-clauses are
the only way.
-Brad
------------------------------------------------------------------------------
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