Where exactly should I write the OpenMP "THREADPRIVATE" directive for common blocks and SAVE variables in FORTRAN?

Viewed 51

Can you please tell me exactly where to place the OpenMp THREADPRIVATE directive for the common block? Immediately after the description of this block, immediately after the description of this block and all other variables of any kind, or only after all DATA blocks? Example:

SUBROUTINE SCHNEVPDH (RZ,FLAT,FLON,R,T,L,BN,BE,BV)
      PARAMETER   (IBO=0,JBO=1,KDIM=8,LDIM=4)
      DIMENSION   FN(0:KDIM,0:KDIM), CONSTP(0:KDIM,0:KDIM)
      DIMENSION   CML(KDIM), SML(KDIM)
      DIMENSION   DELT(0:LDIM)
      DIMENSION   BINT(0:KDIM,0:KDIM,1-IBO-JBO:LDIM),
     *            BEXT(0:KDIM,0:KDIM,1-IBO-JBO:LDIM)
      COMMON    /CONST/UMR,PI
     *          /AMTB/BINT,BEXT,RE,TZERO,IFIT,IB,KINT,LINT,KEXT,
     *              LEXT,KMAX,FN
      CHARACTER*1 IE,RESP
      DATA ((CONSTP(N,M), M=0,N), N=0,KDIM)
     *   /4*1.,1.73205,0.866025,1.,2.44949,1.93649,0.7905691,1.,
     *    3.16228,3.35410,2.09165,0.739510,1.,3.87298,5.12348,
     *    4.18330,2.21853,0.701561,1.,4.58258,2*7.24569,4.96078,
     *      2.32681,0.671693,1.,5.29150,9.72111,11.4564,9.49918,
     *      5.69951,2.42182,0.647260,1.,6.,12.5499,16.9926,16.4531,
     *      11.8645,6.40755,2.50683,0.626707/
!$OMP THREADPRIVATE(/CONST/)
!$OMP THREADPRIVATE(/AMTB/)
      IBF   =  2
      T1=1.
      T2=12.
      CALL TBFIT (T1,T2,IBF,THINT,TZERO)

Is this directive in the right place? The same question applies to SAVE type variables.

0 Answers
Related