PVF 13.4 compiler?

Started out with the routine (edited to be simpler) as shown:

!DK STATIONARY_RECHECK
      SUBROUTINE STATIONARY_RECHECK
      IMPLICIT NONE
!
      INCLUDE 'paramset.fi'
      INCLUDE 'dziinfo.fi'
      INCLUDE 'gopt.fi'
      INCLUDE 'gtime.fi'
      INCLUDE 'heating.fi'
      INCLUDE 'sites.fi'
      INCLUDE 'stationary.fi'
      INCLUDE 'stem_status.fi'
      INCLUDE 'vapor.fi'
      INCLUDE 'write.fi'
!
! Local variables
!
      INTEGER :: i, j, k, idiff, idiff_last
      INTEGER :: min_num_occurances
      INTEGER :: count_min_sites
      INTEGER, DIMENSION(ndrymax) :: tau_counter
      INTEGER, DIMENSION(ndrymax) :: mult_min_sites
      INTEGER, DIMENSION(100,ndrymax) :: stems_each_multiple
!
!
!     RECHECK HOVERING PERIODS BASED ON THE ONES THAT OCCUR INFREQUENTLY.
!     LONG STATIONARY PERIODS NOT FOUND MIGHT BE BASED ON THESE.
!
      min_num_occurances = COUNTCHANGINGSITES(1)
      mult_min_sites(1) = CHANGINGSITES(1)
      count_min_sites = 1
      
      DO i=2,countchanging
         IF ( COUNTCHANGINGSITES(i)<=min_num_occurances ) THEN
            IF ( COUNTCHANGINGSITES(i)==min_num_occurances ) THEN
               count_min_sites = count_min_sites + 1
               mult_min_sites(count_min_sites) = CHANGINGSITES(i)
            ELSE
               min_num_occurances = COUNTCHANGINGSITES(i)
            ENDIF
         ENDIF
      ENDDO
      
      DO j=1,total_num_taus
         tau_counter(j) = 0
      ENDDO
   
      WRITE (6,99030) count_min_sites
      WRITE (6,99040) (mult_min_sites(i),i=1,count_min_sites)
.
.
.
.
.
.      
      RETURN
!
!     FORMAT STATEMENTS
99030 FORMAT (//,i3,' multiple sites with least number of intermediate activations')
99040 FORMAT ('   Sites are', 10i4)
!
      END SUBROUTINE STATIONARY_RECHECK

The problem lies in this section of code

      DO j=1,total_num_taus
         tau_counter(j) = 0
      ENDDO

It overwrites
mult_min_sites(i),i=1,count_min_sites
with zeros.

To show this, I put write statements around that section of the code, i.e.

      WRITE (6,99040) (mult_min_sites(i),i=1,count_min_sites)
      DO j=1,total_num_taus
         tau_counter(j) = 0
      ENDDO
      WRITE (6,99040) (mult_min_sites(i),i=1,count_min_sites)

that produces the following two lines of printout
Sites are 15 143
Sites are 0 0

I can move the problem code to the first executable part of the routine so that

!DK STATIONARY_RECHECK
      SUBROUTINE STATIONARY_RECHECK
      IMPLICIT NONE
!
      INCLUDE 'paramset.fi'
      INCLUDE 'dziinfo.fi'
      INCLUDE 'gopt.fi'
      INCLUDE 'gtime.fi'
      INCLUDE 'heating.fi'
      INCLUDE 'sites.fi'
      INCLUDE 'stationary.fi'
      INCLUDE 'stem_status.fi'
      INCLUDE 'vapor.fi'
      INCLUDE 'write.fi'
!
! Local variables
!
      INTEGER :: i, j, k, idiff, idiff_last
      INTEGER :: min_num_occurances
      INTEGER :: count_min_sites
      INTEGER, DIMENSION(ndrymax) :: tau_counter
      INTEGER, DIMENSION(ndrymax) :: mult_min_sites
      INTEGER, DIMENSION(100,ndrymax) :: stems_each_multiple
!
!
!     RECHECK HOVERING PERIODS BASED ON THE ONES THAT OCCUR INFREQUENTLY.
!     LONG STATIONARY PERIODS NOT FOUND MIGHT BE BASED ON THESE.
!
      DO j=1,total_num_taus
         tau_counter(j) = 0
      ENDDO
      
      min_num_occurances = COUNTCHANGINGSITES(1)
      mult_min_sites(1) = CHANGINGSITES(1)
      count_min_sites = 1
      
      DO i=2,countchanging
         IF ( COUNTCHANGINGSITES(i)<=min_num_occurances ) THEN
            IF ( COUNTCHANGINGSITES(i)==min_num_occurances ) THEN
               count_min_sites = count_min_sites + 1
               mult_min_sites(count_min_sites) = CHANGINGSITES(i)
            ELSE
               min_num_occurances = COUNTCHANGINGSITES(i)
            ENDIF
         ENDIF
      ENDDO
   
      WRITE (6,99030) count_min_sites
      WRITE (6,99040) (mult_min_sites(i),i=1,count_min_sites)
.
.
.
.
.

and the correct output is yielded.

Using PVF 13.4, with the following compiler options:
-Bstatic -Mbackslash -I"F:\Macro3d\PGI\PGI_5-5-2013\Include Files" -I"d:\program files\pgi\win64\13.4\include" -I"D:\Program Files\PGI\Microsoft Open Tools 11\include" -I"D:\Program Files\PGI\Microsoft Open Tools 11\PlatformSDK\include" -fastsse -Mipa=fast,inline -O3 -Mvect=simd:256 -Minline -Munroll=n:4 -Mconcur -tp=sandybridge-64 -Minform=warn -Mkeepasm -Minfo=accel,ftn,inline,loop,opt,par,vect

Is there a problem or did I miss something?

Thanks for your assistance.

Hi Ralph,

What’s the values for “ndrymax” and “total_num_taus”?

My best guess is that you’re writing beyond the end of “tau_counter”. When using “-Mconcur” or “-mp”, automatics are allocated on the stack, meaning that if you are writing beyond the end of “tau_counter”, you’re writing in “mult_min_sites”.

If that’s not it, then I’ll need a reproducing example to determine the cause.

  • Mat

Matt,

Yes, that’s it. Loop should be out to ndrymax, not total_num_taus. Thanks.

If I turn on array bounds checking, how would it show me the problem? An output file somewhere or does the program stop. Assume it would slow the program execution down significantly?


-ralph

Hi Ralph,

If I turn on array bounds checking, how would it show me the problem?

If the bounds of the array is known, which is the case here, then yes.

An output file somewhere or does the program stop. Assume it would slow the program execution down significantly?

The program stops. It will slow it down a bit but not significantly. It’s not a flag you’d use for your final production, just during debugging.

  • Mat

Matt,

Only debugging?

Strange it shows up as an option within the PVF options (run-time options under VS2008) when you’ve selected highly optimized, etc. It must have reset things without telling me — still seems to indicate it is a released version within the properties but runs very slowly (like a debug version).

Glitch in the interface? Of course, I could be the glitch.

-ralph

Only debugging?

You could put it in a production build, I just wouldn’t recommend it. Hopefully by the time you get to that point you shouldn’t need it.

  • Mat