25
edits
Changes
→Task Parallelism
=== Task Parallelism ===
==== basic ====
const numTasks = here.numPUs();
cobegin {
writeln("Hello from task 1 of 2");
writeln("Hello from task 2 of 2");
}
coforall tid in 1..numTasks do
writef("Hello from task %n of %n\n", tid, numTasks);
==== Sync/Singles ====
var sy$: sync int = 2; // state = full, value = 2
var getSy = sy$; // sy$: state = empty
writeln(getSy);
var done$: sync bool;
writeln("Create task");
begin {
var sy = sy$; // This statement will block until sy$ is full
writeln("In new task, sy=", sy);
done$ = true;
}
writeln("Task created");
sy$ = getSy;
var result = done$;
writeln(result);
=== Locality ===
=== Data Parallelism ===