Open main menu

CDOT Wiki β

Changes

Midnight Tiger

66 bytes added, 09:26, 5 April 2016
Task vs Thread
Iterations in a loop will be executed in parallel.
 
=== forall ===
* '''forall''': When the first iteration starts the tasks will be created on each available thread. It's recommended to use when the iteration size is bigger than the number of threads. It might not run in parallel, when there is not enough thread available.
[[Image:Chpl_output.PNG|Output Example]]
 
=== coforall ===
* '''coforall''': A task will be created at each iteration. It's recommended to use coforall when the computation is big and the iteration size is equal to the total number of logical cores(thread). Parllel is mandatory here.
[[Image:coforall.PNG|Output Example]]
 
=== begin ===
* '''begin''': Each begin statement will create a different task.
[[Image:begin.PNG|Output Example]]
 
=== cobegin ===
* '''cobegin''': the each statement in cobegin block will be parallelized.