Open main menu

CDOT Wiki β

Changes

Midnight Tiger

397 bytes added, 20:55, 4 April 2016
How to parallelize your code using Chapel Cray
== How to parallelize your code using Chapel Cray ==
Iterations in a loop will be executed in parallel if there is no dependency. forall: At the beginning of the first iteration all the threads will be created.
* Sample Parallel Code using '''forall'''
[[Image:Chpl_output.PNG|Output Example]]
 
coforall: A thread will be created at each iteration. It's recommended to use coforall when the inside of loop is big and the iteration size is equal to the total number of logical cores.
 
* Sample Parallel Code using '''forall'''
 
<pre>
config const n = here.numCores;
corforall i in 1..n do
writeln("Thread #", i,"of ", n);
</pre>
== Demonstration of Sample Code ==
== Useful Links ==