1
edit
Changes
→How to parallelize your code using Chapel Cray
== How to parallelize your code using Chapel Cray ==
* '''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''': When the first iteration starts the threads tasks will be created on coreseach available thread. When It's recommended to use when the number of iterations iteration size is bigger than the number of threads. It might not run in parallel, when there is not enough thread available.
* Sample Parallel Code using '''forall'''
[[Image:Chpl_output.PNG|Output Example]]
* '''coforall''': A thread task will be created at each iteration. It's recommended to use coforall when the inside of loop computation is big and the iteration size is equal to the total number of logical cores(thread). Parllel is mandatory here.
* Sample Parallel Code using '''coforall'''