Hello,
I have a problem with pgf90 (it works with others compilers) in a MPI code. It’s version 16.9 on linux running computing nodes.
In some small nested loops, I initialize all the elements of an array to a constant value. Next I change some specific element’s values, one by one, by direct assignment with some scalars. Then I print these array’s elements : one was not modified !
If I print in the same “write” instruction the scalar used and the array’s element that should have been modified, the scalar has the good value, the scalar is correct, the array’s element is incorrect.
The problem occurs whatever the number of MPI processes, It does not happen near communication phases or with communicated variables.
It does occur with -O3 optimization level but not with -O0. So, is there some tricky padding issue or something like that ?
The array and the scalars are declared in a module file :
INTEGER, DIMENSION(3,2,-1:+1,-1:+1,-1:+1) :: madd3D
INTEGER, PARAMETER :: im1 = -1, i0 = 0, ip1 = +1
The initialization loops are :
DO kk = im1, ip1
DO jj = im1, ip1
DO ii = im1, ip1
madd3D(1,1,ii,jj,kk) = -5
madd3D(2,1,ii,jj,kk) = -5
madd3D(3,1,ii,jj,kk) = -5
madd3D(1,2,ii,jj,kk) = -5
madd3D(2,2,ii,jj,kk) = -5
madd3D(3,2,ii,jj,kk) = -5
END DO
END DO
END DO
The assignement with the scalar variables are :
madd3D(1,1,i0,i0,i0) = i1add
madd3D(2,1,i0,i0,i0) = j1add
madd3D(3,1,i0,i0,i0) = k1add
madd3D(1,2,i0,i0,i0) = i2add
madd3D(2,2,i0,i0,i0) = j2add
madd3D(3,2,i0,i0,i0) = k2add
The I/O lines are :
WRITE (11,'(A,4I8)') 'i1add, i2add ', i1add, i2add, madd3D(1,1,i0,i0,i0), madd3D(1,2,i0,i0,i0)
WRITE (11,'(A,4I8)') 'j1add, j2add ', j1add, j2add, madd3D(2,1,i0,i0,i0), madd3D(2,2,i0,i0,i0)
WRITE (11,'(A,4I8,/)') 'k1add, k2add ', k1add, k2add, madd3D(3,1,i0,i0,i0), madd3D(3,2,i0,i0,i0)
For -O3, in the result file I get :
i1add, i2add 3 3 3 3
j1add, j2add 3 3 3 3
k1add, k2add 3 3 3 -5
For -O0, in the result file I get :
i1add, i2add 3 3 3 3
j1add, j2add 3 3 3 3
k1add, k2add 3 3 3 3
Compilation options for optimization level :
pgf90 -O3 -Ktrap=fp -Mextend -I. -I/opt/san/sgi/mpt/2.09/include/pgi -Mmpi=sgimpi -mcmodel=medium -g -traceback -Mpreprocess -noacc -c
Compilation options for debugging level :
pgf90 -O0 -Mbounds -Mdclchk -Mchkfpstk -Mchkstk -Mdalign -Mdepchk -Miomutex -Mrecursive -Msave -Ktrap=fp -Minfo=all -Mextend -I. -I/opt/san/sgi/mpt/2.09/include/pgi -Mmpi=sgimpi -mcmodel=medium -g -traceback -Mpreprocess -noacc -c
Thank you in advance for your advices.
Regards,
Guy.