{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs140-multicorematrix

cs140-multicorematrix - CS 140 Numerical Examples on Shared...

Info icon This preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CS 140 : Numerical Examples on Shared Memory with Cilk++ Matrix-matrix multiplication Matrix-vector multiplication Hyperobjects Thanks to Charles E. Leiserson for some of these slides
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
2 T P = execution time on P processors T 1 = work T = span * * Also called critical-path length or computational depth . Speedup on p processors T 1 /T p Parallelism T 1 /T Work and Span (Recap)
Image of page 2
3 cilk_for (int i=0; i<n; ++i) { A[i]+=B[i]; } Vector addition Work: T 1 = Θ (n) Span: T = Parallelism: T 1 /T = Θ (n/lg n) = = Θ (lg n) = Cilk Loops: Divide and Conquer G grain size Assume that G = Θ (1) . Implementation
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
4 Square-Matrix Multiplication c 11 c 12 c 1n c 21 c 22 c 2n c n1 c n2 c nn a 11 a 12 a 1n a 21 a 22 a 2n a n1 a n2 a nn b 11 b 12 b 1n b 21 b 22 b 2n b n1 b n2 b nn = · C A B c ij = k = 1 n a ik b kj Assume for simplicity that n = 2 k .
Image of page 4