parallel processing - Calling a gfortran subroutine under OpenMP -


i have problem getting subroutine work under openmp. variable declarations (private, shared, firstprivate) seem okay, code works when subroutine statements written in line code. created toy problem demonstrates problem, proga.f works, while progb.f not. common region both programs is:

    program proga/b   use modprog     integer kmp     double precision dgam,gamma(10),phi(10),pphi(10),nderiv(10,10)     open(20,file='a/b.dat')     nn=10     dgam=0.1d-6     10 i=1,nn 10   gamma(i)=dfloat(i)     call gamset(gamma)     call errvec(phi) 

the parallel region of (which works) is

!$omp parallel shared(nn,dgam,phi,nderiv)  !$omp& private(pphi,cm) !$omp& firstprivate(gamma)      100 kmp=1,nn     gamma(kmp)=gamma(kmp)+dgam     15 i=1,nn 15   cm(i)=gamma(i)     20 i=1,nn 20   pphi(i)=cm(i)**2      40 j=1,nn 40   nderiv(j,kmp)=(pphi(j)-phi(j))/dgam     gamma(kmp)=gamma(kmp)-dgam 100   continue  !$omp end parallel 

while parallel region of progb (which doesn't work)

!$omp parallel shared(nn,dgam,phi,nderiv)  !$omp& private(pphi,cm) !$omp& firstprivate(gamma)      100 kmp=1,nn     gamma(kmp)=gamma(kmp)+dgam     call gamset(gamma)     call errvec(pphi)     40 j=1,nn 40   nderiv(j,kmp)=(pphi(j)-phi(j))/dgam     gamma(kmp)=gamma(kmp)-dgam 100   continue  !$omp end parallel 

the common subroutines , module 2 programs

    subroutine gamset(gamma)     use modprog     double precision gamma(10)     15 i=1,nn 15   cm(i)=gamma(i)     return     end  c             subroutine errvec(phi)     use modprog     double precision phi(10)     20 i=1,nn 20   phi(i)=cm(i)**2      return     end  c     module modprog     integer nn     double precision cm(10)     end module 


Comments

Popular posts from this blog

javascript - Create a stacked percentage column -

Optimising Firebase database by automatically overwriting data -

javascript - Angular UI-Grid customTemplate directive causing rows to load slowly/? -