error: identifier "size_t" is undefined

I have the next example CUDA PGI code:

module VectorSumModul
use cudafor
contains

attributes(global) subroutine VectorSum_kernel(v,s,sizevector)

implicit none

integer, value :: sizevector
real, value :: s
real, device :: v(sizevector)

integer :: tx

tx = threadidx%x

v(tx) = v(tx) + s

end subroutine VectorSum_kernel

end module VectorSumModul

program Main

use cudafor
use VectorSumModul

implicit none

integer, parameter :: sizevector = 512
real, parameter :: s = 5

real, allocatable :: v(:)
real, device, allocatable :: cudav(:)

integer :: i

allocate (v(sizevector))

allocate (cudav(sizevector))

do i=1,sizevector
v(i) = 1
end do

!print *,“v=”, v(512)

cudav = v

call VectorSum_kernel<<<1,sizevector>>>(cudav,s,sizevector)

v = cudav

!print *,“v=”, v(512)

deallocate (v)

deallocate (cudav)

end program Main


I know that this code works fine, however in my machine doesn’t work. When I compile
“pgfortran VectorSum.cuf” I recieve :

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(186): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(187): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(188): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(197): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(198): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(199): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(208): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(209): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(210): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(237): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(238): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(239): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(264): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(265): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(268): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(273): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(276): error: identifier “size_t” is undefined

17 errors detected in the compilation of “/tmp/pgnvdVt6cnUobsBXL.nv2”.
PGF90-F-0000-Internal compiler error. pgnvd job exited with nonzero status code 0 (VectorSum.cuf: 20)
PGF90/x86-64 Linux 10.8-0: compilation aborted
pedro@pedro:~/Poisson/PGIExample$ pgfortran VectorSum.cuf
/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(186): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(187): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(188): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(197): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(198): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(199): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(208): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(209): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(210): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(237): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(238): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(239): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(264): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(265): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(268): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(273): error: identifier “size_t” is undefined

/opt/pgi/linux86-64/2010/cuda/2.3/include/driver_types.h(276): error: identifier “size_t” is undefined

17 errors detected in the compilation of “/tmp/pgnvdUK6cknxzRmVD.nv2”.
PGF90-F-0000-Internal compiler error. pgnvd job exited with nonzero status code 0 (VectorSum.cuf: 20)
PGF90/x86-64 Linux 10.8-0: compilation aborted

Can someone help me?

Hi Programming and compiling,


What gcc and OS version are you using?

The most likely cause of this issue is that the GCC version you have installed is too new and not compatible with older versions of CUDA (in this case 2.3). If you have gcc version 4.5 or later, you will need to update your compiler to at least PGI 12.10 since this version includes CUDA 4.2.

You could also try downgrading your GCC version. Let me know if you want to do this and I’ll find out what the last version of GCC CUDA 2.3 worked with.

Best Regards,
Mat

Hi Mak,

I use Ubuntu 11.10 and gcc 4.6.

How can I downgrade gcc?

Pedro.

Hi Pedro,

Looks like you’ll need a pre-4.4 gcc, possibly even as far back as gcc 4.1. PGI 10.8 is three years old and the last supported Ubuntu for it was 9.04.

How can I downgrade gcc?

I have not done this before so don’t know for sure, but would try getting an old gcc version, build and install in a separate directory, then set your PATH so this version is picked up before the system’s version. I’m not possitive that this will work or if you wont encounter other issues.

The recommended course of action would be to upgrade to 12.10 or later.

  • Mat