Changes

Jump to: navigation, search

GPU621/Chapel

382 bytes added, 23:38, 29 November 2022
Parallel Iterators
Chapel has two main types of parallel iterators:
*Standalone parallel iterators are the simpler form and can be used to define parallelism for a simple forall loop.
iter fibonacci(n: int): int {
var i1 = 0, i2 = 1;
for i in 1..#n {
yield i1;
var i3 = i1 + i2;
i1 = i2;
i2 = i3;
}
}
config const n =10;
for (i,idVar) in zip(0..n, fibonacci(n)) do
writeln("#", i, " - ", idVar);
*Leader-follower iterators are a more involved form that support zippered forall loops.
forall (a, b, c) in zip(A, B, C) do
//in here, A is the leader; and A, B, C is followers
= Reference =
73
edits

Navigation menu