1
$\begingroup$

CLRS book has the following algorithm for parallel for matrix vector multiplication enter image description here

My problem is, can't we use a simple approach like this,

MAT-VEC-MULTIPLY-MAIN(A,x,y,n)
    for i = 2 to n
        spawn MULTIPLY-ROW(A,x,y,n,i)

    MULTIPLY-ROW(A,x,y,n,1)     
    sync   

MULTIPLY-ROW(A,x,y,,n,row)
    for j = 1 to n
        y[row] = y[row] + a[row]j.xj

Both approaches generate same number of threads (One thread for each row). Is there any performance difference between these two?

$\endgroup$
  • $\begingroup$ Can you profile them and see? $\endgroup$ – user1118321 Jul 14 '17 at 2:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.