lec10 - Matrix Multiplication Prepared by Thoai Nam...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Matrix Multiplication Prepared by: Thoai Nam Lectured by: Tran Vu Pham-2- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Outline b Sequential matrix multiplication b Algorithms for processor arrays – Matrix multiplication on 2-D mesh SIMD model – Matrix multiplication on hypercube SIMD model b Matrix multiplication on UMA multiprocessors b Matrix multiplication on multicomputers-3- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Sequential Matrix Multiplication Global a[0..l-1,0..m-1], b[0..m-1][0..n-1], {Matrices to be multiplied} c[0..l-1,0..n-1], {Product matrix} t, {Accumulates dot product} i, j, k; Begin for i:=0 to l-1 do for j:=0 to n-1 do t:=0; for k:=0to m-1 do t:=t+a[i][k]*b[k][j]; endfor k; c[i][j]:=k; endfor j; endfor i; End.-4- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Algorithms for Processor Arrays b Matrix multiplication on 2-D mesh SIMD model b Matrix multiplication on Hypercube SIMD model-5- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Matrix Multiplication on 2D-Mesh SIMD Model b Gentleman(1978) has shown that multiplication of to n*n matrices on the 2-D mesh SIMD model requires 0(n) routing steps b We will consider a multiplication algorithm on a 2- D mesh SIMD model with wraparound connections-6- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Matrix Multiplication on 2D-Mesh SIMD Model (cont’d) b For simplicity, we suppose that – Size of the mesh is n*n – Size of each matrix (A and B) is n*n – Each processor P i,j in the mesh (located at row i,column j) contains a i,j and b i,j b At the end of the algorithm, P i,j will hold the element c i,j of the product matrix-7- Khoa Khoa H u c & K U Thu ¡ t Máy Tính – Tr ư¢ ng £¤ i H u c Bách Khoa TP. HCM Matrix Multiplication on 2D-Mesh SIMD Model (cont’d) b Major phases (a) Initial distribution of matrices A and B (b) Staggering all A’s elements in row i to the left by i positions and all B’s elements in col j...
View Full Document

This note was uploaded on 09/10/2011 for the course CS 6143 taught by Professor Hadimioglu during the Spring '10 term at NYU Poly.

Page1 / 23

lec10 - Matrix Multiplication Prepared by Thoai Nam...

This preview shows document pages 1 - 8. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online