CUDA Fortran : -fast changes result

I have written a very simple program to isolate a problem I’m seeing. Basically, “-fast” causes my device functions to stop working. I’ve pasted the code below:

      module gpufunc
      use cudafor
      implicit none

      contains
c === ==================================================================
      attributes(device) REAL FUNCTION myarg(argin)
      IMPLICIT NONE

      REAL,DEVICE :: argin
      
      myarg = argin * -1.0
      
      END FUNCTION myarg
c === ==================================================================
      attributes(global) SUBROUTINE myarg_helper(argin,argout)
      IMPLICIT NONE
      REAL,VALUE :: argin
      REAL,DEVICE :: temp
      REAL,DEVICE :: argout(1)
      
      temp = argin
      argout(1) = myarg(temp)

      END SUBROUTINE myarg_helper
c === ==================================================================
      end module gpufunc
c === ==================================================================
c === ==================================================================

      program fcuda
      use gpufunc
      implicit none

      real :: argin
      real,device :: argout(1)
      real :: temp
            
      argin = 1.0
      call myarg_helper<<<1,1>>>(argin,argout)
      temp = argout(1)
      print *,argin
      print *,temp
     
      end program fcuda

Without “-fast”, I get 1.0 and -1.0, as expected. With “-fast”, I get 1.0 and 0.0 ! I appreciate any help!

Thanks,
Todd

Hi Todd,

Looks like compiler error. Fortunately, it appears to have found and fixed internally with the fix being available in next weeks 10.2 release.

% pgf90 -fast test.cuf -Mfixed -o testFast.out -V10.1
% testFast.out
    1.000000
    0.000000
% pgf90 -fast test.cuf -Mfixed -o testFast.out -V10.2
% testFast.out
    1.000000
   -1.000000

Thanks,
Mat