Dear all,
The following code is used to calculate y = A * x as the function mkl_?coogemv:
do i=1,n ! matrix A is the size of n*n
y(i)=0.0d0
enddo
do i=1,nnz ! nnz is the number of entries of A
ii = irow(i) ! irow is the row number index of entries
jj = jcol(i) ! jcol is the column number index of entries
y(ii) = y(ii) + A(i)*x(jj)
enddo
Could anyone give me some suggestion about how to parallelize the code by OpenMP?
If the matrix is symmetric, additional operations are needed. The sequential version of code is as follows:
do i=1,n ! matrix A is the size of n*n
y(i)=0.0d0
enddo
do i=1,nnz ! nnz is the number of entries of A, only half of the elements
! of the matrix are stored
ii = irow(i) ! irow is the row number index of entries
jj = jcol(i) ! jcol is the column number index of entries
y(ii) = y(ii) + A(i)*x(jj)
if(issymmetric.and.ii/=jj)y(jj)=y(jj)+A(i)*x(ii)
enddo
Thanks,
Zhanghong Tang[/code]