這裏一點幫助矩陣的並行(逐字)版本矢量乘法在這本書中關於OpenMP和gomp
subroutine matvecmul(mat,vec,res,m,n)
use omp_lib
implicit none
integer::m,n,i,j
real*8,dimension(m,n),intent(in)::mat
real*8,dimension(n),intent(in)::vec
real*8,dimension(m)::res
res(:)=0.0
!$omp parallel do default(none)
!$omp shared(mat,vec,res,m,n) private(i,j)
do i=1,m
do j=1,n
res(i)=res(i)+mat(i,j)*vec(j)
end do
end do
!$omp end parallel do
return
end subroutine matvecmul
我得到這個語法錯誤執行「未分類的OpenMP子句共享「,」未分類的openMP子句私有「 用gfortran 4.4.5和gfortran編譯4.6.0
是在」gomp「中刪除/ ta的書... 與默認(一)我沒有得到任何語法錯誤我應該怎麼說哪些變量是私人的,哪些是共享的?
這裏是我沒有錯誤(正確)
subroutine matvecmul(mat,vec,res,m,n)
use omp_lib
implicit none
integer::m,n,i,j
real*8,dimension(m,n),intent(in)::mat
real*8,dimension(n),intent(in)::vec
real*8,dimension(m)::res
res(:)=0.0
!$omp parallel do private(i,j)
do i=1,m
do j=1,n
res(i)=res(i)+mat(i,j)*vec(j)
end do
end do
!$omp end parallel do
return
end subroutine matvecmul
實現我還是爲OpenMP一個新手(但我需要學習是我的工作快...一部分!) 一些交代這裏將不勝感激。 是否有任何openMP教程只使用gomp(比如說gcc/gfortran 4.4.5)?
好的... thanx,所以它是書中的錯字。 – fedvasu