























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























































Dr. Rodric Rabbah, IBM.
1
6.189 IAP 2007 MIT
2
6.189 IAP 2007 MIT
^ Distributed memory–^ Ex: Cell–^ Cores primarily access localmemory–^ Explicit data exchangebetween cores–^ Data distribution andcommunication orchestrationis essential for performance
PP^1
P^3
Pn MemoryInterconnection Network
Interconnection NetworkPP 1 2
P^3
Pn MM^1
M 2 3
Mn
●^ Two primary patterns of multicore architecture design
4
6.189 IAP 2007 MIT
i = 0i = 1i = 2i = 3
i = 4i = 5i = 6i = 7
i = 8i = 9i = 10i = 11 fork (threads) join (barrier)
5
6.189 IAP 2007 MIT
int^ B[12]
int^ C[12];
void^ add_arrays(int
start)
{ int^
i; for (i^ =^ start;
i^ <^ start
+^ 4;^ i++)
C[i]^ =^
A[i]^ +^
B[i]; } int^ main
(int^ argc,^ char
*argv[])
{ pthread_t
threads_ids[3]; int^ rc,
t; for(t^ =^ 0;^ t^
<^ 4;^ t++)
rc^ =^ pthread_create(&thread_ids[t],
/*^ attributes
add_arrays /*
function
t^ *^4
/*^ args
to^ function
} pthread_exit(NULL);}
i = 0i = 4i = 1i = 5i = 2i = 6i = 3i = 7^ join (barrier)
i = 8i = 9i = 10i = 11 fork (threads)
7
6.189 IAP 2007 MIT
8
6.189 IAP 2007 MIT
i = 0i = 4i = 1i = 5i = 2i = 6i = 3i = 7^ join (barrier)
i = 8i = 9i = 10i = 11 fork (threads)
10
6.189 IAP 2007 MIT
P^1 How is “data” described– How are processes identified– Will receiver recognize or screen messages– What does it mean for a send or receive to complete
11
6.189 IAP 2007 MIT
for^ (i^
=^1 to^
for^ (j =^1 to
C[i][j]
=^ distance(A[i],
B[j])
P^1 M^1
M P 2 2
x
●^ Calculate the distance from each point iny^ B A
A[^ ..
4]
to every other point in
B[1..
4]^ and store results to
C[^ ..
4][
..4]
13
6.189 IAP 2007 MIT
Dr. Rodric Rabbah, IBM.
P^1 M^1
M P 2 2
for^ (i^
=^1 to^
for^ (j =^1 to
C[i][j]
=^ distance(A[i],
B[j])
A[^ ..
4]
to every other point in
B[1..
4]^ and store results to
C[^ ..
4][
..4] ●^ Can break up workbetween the twoprocessors^ ^ Psends data to^1
P^2
14
6.189 IAP 2007 MIT
●^ Can break up workbetween the twoprocessors^ ^ P^1 Dr. Rodric Rabbah, IBM.
sends data to
P^2
^ Pand^1
Pcompute^2
P^1 M^1
M P 2 2
for^ (i^
=^1 to^
for^ (j =^1 to
C[i][j]
=^ distance(A[i],
B[j])
A[^ ..
4]
to every other point in
B[1..
4]^ and store results to
C[^ ..
4][
..4]
16
6.189 IAP 2007 MIT
A[n]^ =^ {…}B[n]^ =^ {…} Send^ (A[n/2+1..n], Dr. Rodric Rabbah, IBM.
B[1..n]) for^ (i =^1 to
n/2) for^ (j^
=^1 to^
n) C[i][j]
=^ distance(A[i],
B[j])
Receive(C[n/2+1..n][1..n])
A[n]^ =^
B[n]^ =^
Receive(A[n/2+1..n],
B[1..n])
for^ (i^
=^ n/2+
to^ n) for^ (j^
=^1 to^
n) C[i][j]
=^ distance(A[i],
B[j])
Send^ (C[n/2+1..n][1..n])
processor 1
processor 2
processor 1
sequentialparallel with messages
for^ (i^
=^1 to^
for^ (j^
=^1 to^
C[i][j]
=^ distance(A[i],
B[j])
17
6.189 IAP 2007 MIT
Æ^ 2x speedup ^ Dividing the work betweenfour processors
Æ^ 4x speedup
●^ Communication^ ^ 1 copy of
B[]^ sent to each processor ^ 1 copy of
subset
of^ A[]
to each processor
●^ Granularity of
A[]^ subsets directly impact communication costs ^ Communication is not free
x y
19
6.189 IAP 2007 MIT
Rays bounce around as they strike objects– Rays generate new rays Result is color and opacity for that pixel Parallelism across rays
transmission ray
primary ray
normal
reflection
20
6.189 IAP 2007 MIT
a = b + c;d = a + 1;e = d + a;for (i=0; i < e; i++)M[i] = 1;
Sequential part(data dependence)Parallel part(no data dependence)