Open main menu

CDOT Wiki β

Changes

Midnight Tiger

90 bytes added, 10:26, 5 April 2016
Task vs Thread
== Introduction to Chapel ==
Chapel(Cascade High-Productivity Language) is an alternative parallel programming language that focuses on the '''productivity ''' of high-end computing systems.
The concept of "Productivity" is somewhat more special that we might think.
'''Chapel:''' Chapel is the language that is easy to implement the parallel computation that and similar to other languages with granting full control to the users.
== Advantages of Chapel ==
<pre>>cd $CHPL_HOME/examples</pre>
== How to parallelize your code using Chapel Cray ===== Task vs Thread ===
* '''Task''': A unit of computation
 
* '''Thread''': A hardware resource where a task can be mapped to.
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.