{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

l12-handout - Lecture 12 Parallelization I Basic...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Lecture 12 Parallelization I. Basic Parallelization II. Data dependence analysis III. Interprocedural parallelization Chapter 11.1-11.1.4 M. Lam CS243: Parallelization 1 Parallelization of Numerical Applications DoAll loop parallelism Find loops whose iterations are independent Number of iterations typically scales with the problem Usually much larger than the number of processors in a machine Divide up iterations across machines M. Lam CS243: Parallelization 2
Background image of page 1

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

View Full Document Right Arrow Icon
2 Basic Parallelism Examples : FOR i = 1 to 100 A[i] = B[i] + C[i] FOR i = 11 TO 20 a[i] = a[i-1] + 3 FOR i = 11 TO 20 a[i] = a[i-10] + 3 Does there exist a data dependence edge between two different iterations? A data dependence edge is loop-carried if it crosses iteration boundaries DoAll loops : loops without loop-carried dependences M. Lam CS243: Parallelization 3 Recall: Data Dependences True dependence: a = = a Anti-dependence: = a a = Output dependence a = a = M. Lam CS243: Parallelization 4
Background image of page 2
3 Affine Array Accesses Common patterns of data accesses: (i, j, k are loop indexes) A[i], A[j], A[i-1], A[0], A[i+j], A[2*i], A[2*i+1] A[i,j], A[i-1, j+1] Array indexes are affine expressions of surrounding loop indexes Loop indexes: i n , i n-1 , ... , i 1 Integer constants: c n , c n-1 , ... , c 0 Array index: c n i n + c n-1 i n-1 + ... + c 1 i 1 + c 0 Affine expression: linear expression + a constant term (c 0 ) M. Lam CS243: Parallelization 5 II. Formulating Data Dependence Analysis FOR i := 2 to 5 do A[i-2] = A[i]+1; Between read access A[i] and write access A[i-2] there is a dependence if: there exist two iterations i r and i w within the loop bounds, s.t. iterations i r & i w read & write the same array element , respectively integers i w , i r 2 i w , i r 5 i r = i w - 2 Between write access A[i-2] and write access A[i-2] there is a dependence if: integers i w , i v 2 i w , i v 5 i w
Background image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}