Private Data in Common Block lost at exit of Parallel Region

I am running a program which has multiple OpenMP parallel regions which use the same privately declared common block. At the exit of the parallel regions the data in the common block appears to be destroyed. The problem is that some of the data in the block contains constants that should not change during execution. These values are needed for subsequent passes through parallel regions. The code fails because of changes to the constant data in the parallel region following the initial parallel region. The data is retained and the code works properly using SGI, Intel and Sun compilers. Is there a work around for this?

Colin

Hi Colin,

Please provide a short example. Which version of compiler? How can you declare common block private?

Hongyon

Hi Hongyon,

I am running PGF90version 6.2 on a linux cluster. The cluster has two processors per node. I am trying to run the OpenMp on one node (the master node).

Below is an example of the code:


Below is a typical common block declaration

COMMON /INIT/TEXTC,TEXER,DEXT,ISUM,IPG(5000),IPGN(5000),
1 KSTPSV(5000),ITETNSAV(5000),ND1,ND2,ND3

Below are the declarations for the private common blocks. These produce private copies of the common block for each processor.



C$OMP THREADPRIVATE(/TRAJCOM/,/INIT/,/XSID/,/IPACHK/,/IMPC/)
C$OMP THREADPRIVATE(/GCELS/,/VELNC/,/DISTSTUFF/,/IMREC/,/TRAJWRIT/)
C$OMP THREADPRIVATE(/DVDQSTUFF/,/TRAJSTC/,/RESTAR/,/CELLIT/,/CHOICE/)
.
.
.
Below is the first parallel region


C$OMP PARALLEL
C$OMP+ COPYIN(/TRAJCOM/,/IMPC/,/INIT/,/XSID/,/IPACHK/)
C$OMP+ COPYIN(/GCELS/,/DISTSTUFF/,/IMREC/,/TRAJWRIT/,/TRAJSTC/)
C$OMP+ COPYIN(/DVDQSTUFF/,/VELNC/,/RESTAR/,/CHOICE/)
C$OMP DO SCHEDULE(DYNAMIC,1)
C$OMP+ PRIVATE (XW,YW,ZW,IIN,XSIN,YSIN,ZSIN,XSOUT,YSOUT,ZSOUT)
DO 10 I=IPR,IP
CALL CONFAC(OUTPUT,JOBSUM,TEMP24,TEMP25,RESTRT,GFILE,
1 ISC,ICONFAUTO,XW,YW,ZW,XSIN,YSIN,ZSIN,
1 XSOUT,YSOUT,ZSOUT,IERC)
10 CONTINUE
C$OMP END PARALLEL

As an example the variable TEXTC in Common Block INIT above was initialized to 1.1 before entering the parallel region. It was not changed during the parallel region. After the parallel region its value was changed and was not usable.

Hi Colin,

Please use 7.1-6 to compiler. Perhaps there was a bug and it was fixed in latest release.

I tried to recreate the error but it was not not reproducible.

If the error still exists in 7.1-6, please you provide a short program that I can compile and run to see what is going one.

Thanks,
Hongyon