Open main menu

CDOT Wiki β

Changes

Midnight Tiger

491 bytes added, 10:26, 5 April 2016
Task vs Thread
= Chapel Cray =
== Team Information ==
== 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. There are three categories of people, interested in Parallel Programming.
'''* Student:Who are interested in Parallel Programming and what do they want?'''I want something that is similar to the languages that I learned in school such as c++, c, and Java. I want it to be easy to implement the parallel programming on my code.
'''* HPC ProgrammersStudent:'''I want something that is similar to the full control languages that gives me more spot I learned in school such as c++, c, and Java. I want it to be easy to increase implement the performanceparallel programming on my code.
'''* Computational ScientistsHPC Programmers:'''I want something the full control that I can easily implement my computation without knowing much architecture knowledgegives me more spot to increase the performance.
'''* Computational Scientists:''' I want something that I can easily implement my computation without knowing much architecture knowledge.
'''Chapel:''' Chapel is the language that easy to implement the parallel computation that similar to other languages with granting full control to the users.
'''Chapel:''' Chapel is the language that is easy to implement the parallel computation and similar to other languages with granting full control to the users. == Advantages of Chapel Cray ==Other current From [http://www.cray.com/blog/chapel-productive-parallel -programming models are limited that they target to specific hardware and they only implement single type / one of parallelism.Cray articles]
* '''General Parallelism:''' Chapel has the goal of supporting any parallel algorithm you can conceive of on any parallel hardware you want to target. In particular, you should never hit a point where you think “Well, that was fun while it lasted, but now that I want to do x, I’d better go back to MPI.”
 
* '''Separation of Parallelism and Locality:''' Chapel supports distinct concepts for describing parallelism (“These things should run concurrently”) from locality (“This should be placed here; that should be placed over there”). This is in sharp contrast to conventional approaches that either conflate the two concepts or ignore locality altogether.
 
* '''Multiresolution Design:''' Chapel is designed to support programming at higher or lower levels, as required by the programmer. Moreover, higher-level features—like data distributions or parallel loop schedules—may be specified by advanced programmers within the language.
 
* '''Productivity Features:''' In addition to all of its features designed for supercomputers, Chapel also includes a number of sequential language features designed for productive programming. Examples include type inference, iterator functions, object-oriented programming, and a rich set of array types. The result combines productivity features as in Python™, Matlab®, or Java™ software with optimization opportunities as in Fortran or C.
<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''': At the beginning of When the first iteration all starts the threads tasks will be createdon 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.
* Sample Parallel Code using '''forall'''
[[Image:Chpl_output.PNG|Output Example]]
=== coforall === * '''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'''
[[Image:coforall.PNG|Output Example]]
=== begin === * '''begin''': Each begin statement will create a different threadtask.
* Sample Parallel Code using '''begin'''
[[Image:begin.PNG|Output Example]]
 
=== cobegin ===
* '''cobegin''': the each statement in cobegin block will be parallelized.
var counts: [0..#tasks] int;
'''coforall''' tid in 0..#tasks {
var rs = new RandomStream(seed, parSafe=false);
const nPerTask = n/tasks,
}
var count = + '''reduce''' counts;
const te = getCurrentTime();
writeln("Approximation of pi = ", count * 4.0 / n);
writeln("Integration: ", te - ts);
</pre>
 
=== Performance ===
 
 
[[Image:pi.png|Performance]]
 
== Working in progress... ==
 
While developing my own program, I got the following issue.
 
[[Image:bug.png|bug]]
== Useful Links ==