CSC/ECE 506 Spring 2010/ch 3 yl: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
Line 48: Line 48:
<ol>
<ol>
<li>[http://en.wikipedia.org/wiki/Parallel_computing wikipedia: Parallel Computing]</li>
<li>[http://en.wikipedia.org/wiki/Parallel_computing wikipedia: Parallel Computing]</li>
<li>[http://www.cesr.ncsu.edu/solihin/Main.html FUNDAMENTALS OF PARALLEL COMPUTER ARCHITECTURE, Yan Solihin, Aug 2009]</li>
</ol>
</ol>

Revision as of 20:25, 20 February 2010

Supplement to Chapter 3: Support for parallel-programming models. Discuss how DOACROSS, DOPIPE, DOALL, etc. are implemented in packages such as Posix threads, Intel Thread Building Blocks, OpenMP 2.0 and 3.0.

Parallel-programming models

Loop-independent vs. loop-carried dependences

Before performing the three kinds of parallelism analysis, we need to discuss about loop-dependence analysis first.

Statement dependences

Let's define S

Loop-independent

Loop-carried dependences

DOALL

for    i:=2:N-1 do A(i):=[A(i-1) + A(i) + A(i+1)]/3; next i;
forall i:=2:N-1 do A(i):=[A(i-1) + A(i) + A(i+1)]/3;
for (i=2; i<=n; i+=2)
 s: a[i] = a[i-2];
for (i=3; i<=n; i+=2)
 s: a[i] = a[i-2];

DOACROSS

for (i=1; i<=N; i++) {
 S: a[i] = a[i-1] + b[i] * c[i];}
for (i=1; i<=N; i++) {
  S1: temp[i] = b[i] * c[i];}
for (i=1; i<=N; i++) {
  S2: a[i] = a[i-1] + temp[i];}
post(0);
for (i=1; i<=N; i++) {
  S1: temp[i] = b[i] * c[i];}
  wait(i-1);
  S2: a[i] = a[i-1] + temp[i];
  post(i);}

DOPIPE

Implementation

References

  1. wikipedia: Parallel Computing
  2. FUNDAMENTALS OF PARALLEL COMPUTER ARCHITECTURE, Yan Solihin, Aug 2009