Parallel Methods for Matrix Multiplication

99 downloads 12851 Views 394KB Size Report
Introduction to Parallel Programming: Matrix Multiplication. © Gergel V.P.. 2 → 50 . Contents. ❑ Problem Statement. ❑ Sequential Algorithm. ❑ Algorithm 1 ...
University of Nizhni Novgorod Faculty of Computational Mathematics & Cybernetics

Introduction to Parallel Programming Section 8.

Parallel Methods for Matrix Multiplication

Gergel V.P., Professor, D.Sc., Software Department

Contents Problem Statement ‰ Sequential Algorithm ‰ Algorithm 1 – Block-Striped Decomposition ‰ Algorithm 2 – Fox’s method ‰ Algorithm 3 – Cannon’s method ‰ Summary ‰

Nizhni Novgorod, 2005

Introduction to Parallel Programming: Matrix Multiplication © Gergel V.P.

2 → 50

Problem Statement Matrix multiplication:

C = A⋅ B or ⎛ c0, 0 , c0,1 , ..., c0,l −1 ⎞ ⎛ a0, 0 , a0,1 , ..., a0,n −1 ⎞ ⎛ b0, 0 , b0,1 , ..., a0,l −1 ⎞ ⎟⎜ ⎟ ⎜ ⎟ ⎜ ... ... ... ⎟⎜ ⎟ ⎜ ⎟=⎜ ⎟⎜ ⎟ ⎜c ⎟ ⎜ ⎝ m −1, 0 , cm −1,1 , ..., cm −1,l −1 ⎠ ⎝ am −1, 0 , am −1,1 , ..., am −1,n −1 ⎠ ⎝ bn −1, 0 , bn −1,1 , ..., bn −1,l −1 ⎠

ª The matrix multiplication problem can be reduced to the execution of m·l independent operations of matrix A rows and matrix B columns inner product calculation

(

n −1

) ∑a

cij = ai , bTj =

ik

⋅ bkj , 0 ≤ i < m, 0 ≤ j < l

k =0

Data parallelism can be exploited to design parallel computations Nizhni Novgorod, 2005

Introduction to Parallel Programming: Matrix Multiplication © Gergel V.P.

3 → 50

Sequential Algorithm… // Algorithm 8.1 // Sequential algorithm of matrix multiplication double MatrixA[Size][Size]; double MatrixB[Size][Size]; double MatrixC[Size][Size]; int i,j,k; ... for (i=0; i

Suggest Documents