compiler information

I wrote a Fortran code as:

program picalc 
      implicit none 
      integer, parameter :: n=10
      integer :: i 
      real(kind=8) :: a(n),b(n),c(n)

        !acc data copy(a,b,c)
        !$acc parallel
      do i=1, n
          a(i) = i
                  b(i) = 1
                  c(i) = a(i) + b(i)
      end do 
        !$acc end parallel
          !acc end data

        write(*,*) c(2)
         
  end program picalc

The compiler information as below:
Compute capability mismatch
file: F:\PVFProject1\PVFProject1\ConsoleApp.f90
routine: picalc
line: 15
device: 0 compute capability 1.2
driver: 4020
Available compute capability: 1.3(elf) 2.0(elf) 2.0(ptx)

I had thought this code need compute capablity with 1.3+
But after I modified the code as below:

program picalc 
      implicit none 
      integer, parameter :: n=10
      integer :: i 
      real(kind=8) :: a(n),b(n),c(n)
       
        !acc data copy(a,b,c)
        !$acc do
      do i=1, n
          a(i) = i
                  b(i) = 1
                  c(i) = a(i) + b(i)
      end do 
        
          !acc end data

        write(*,*) c(2)
         
  end program picalc

This time,the code was compiled succesully. I got some confuseed ,Why?

I’m looking forward your reply.

Merry Christmas

Hi Teslalady,

In the second case, you are not generating a compute kernel due to incorrect syntax. Change “!$acc do” to “!$acc parallel loop” and you’ll get the compute capability error.

Be sure to add “-Minfo=accel” to your compile. If the information is blank, no kernel was generated.

Hope this helps,
Mat

Example using Linux:

% cat test.f90 
program picalc
      implicit none
      integer, parameter :: n=10
      integer :: i
      real(kind=8) :: a(n),b(n),c(n)
       
        !acc data copy(a,b,c)
        !$acc parallel loop 
      do i=1, n
          a(i) = i
                  b(i) = 1
                  c(i) = a(i) + b(i)
      end do
       
          !acc end data

        write(*,*) c(2)
         
  end program picalc 
% pgf90 -acc -Minfo -ta=nvidia,cc12 test.f90 -V12.9
PGF90-S-0155-No valid compute capability generated  (test.f90)
PGF90-W-0155-Compiler failed to translate accelerator region (see -Minfo messages): Could not find GPU binary file (test.f90: 8)
picalc:
      8, Accelerator kernel generated
          9, !$acc loop gang, vector(256) ! blockidx%x threadidx%x
      8, Generating present_or_copyout(c(:))
         Generating present_or_copyout(b(:))
         Generating present_or_copyout(a(:))
         Double precision operations disable compute capability 1.2 kernel
     10, Double precision operations disable compute capability 1.2 kernel
     11, Double precision operations disable compute capability 1.2 kernel
     12, Double precision operations disable compute capability 1.2 kernel
  0 inform,   1 warnings,   1 severes, 0 fatal for picalc