I noticed something in a snippet of code I was given:
var D: domain(2) dmapped Block(boundingBox=Space) = Space;
var A: [D] int;
[a in A] a = a.locale.id;
Is [a in A]
equivalent to forall a in A a = a.locale.id
?
I noticed something in a snippet of code I was given:
var D: domain(2) dmapped Block(boundingBox=Space) = Space;
var A: [D] int;
[a in A] a = a.locale.id;
Is [a in A]
equivalent to forall a in A a = a.locale.id
?
Yes, exactly. In Chapel,
[a in A] expr
is equivalent toforall a in A do expr
.With respect to the title of this question, note that this is independent of whether or not
A
is distributed. For example, you could also write[i in 1..n]
rather thanforall i in 1..n do
.Array types in Chapel, like
[D] real
can similarly be read as