I have a small test program:
program test
type t
integer n
double precision, allocatable, device :: a(:), b(:), c(:)
end type
type(t) x
read *, x%n
allocate(x%a(x%n), x%b(x%n), x%c(x%n))
call f(x%a, x%b, x%c)
print *, sum(x%c)
contains
subroutine f(a, b, c)
double precision, device :: a(:), b(:), c(:)
integer i
!$cuf kernel do *, 256
do i = 1, size(a)
a(i) = 1
b(i) = 1
c(i) = a(i) + b(i)
end do
end subroutine
end program
When I compile it
pgfortran 11.8-0 64-bit target on x86-64 Linux -tp gh
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc. All Rights Reserved.
using
pgfortran test.f90 -otest -Mcuda
the linker complains:
/tmp/pgfortran8iWe0Up28Yol.o: In function `..cuda_fortran_constructor_1':
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
/tmp/pgfortran8iWe0Up28Yol.o:./test.f90:29: more undefined references to `.BSS3' follow
/tmp/pgfortran8iWe0Up28Yol.o: In function `..cuda_fortran_constructor_1':
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
/tmp/pgfortran8iWe0Up28Yol.o:./test.f90:29: more undefined references to `.BSS3' follow
/tmp/pgfortran8iWe0Up28Yol.o: In function `..cuda_fortran_constructor_1':
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
./test.f90:29: undefined reference to `.BSS3'
/tmp/pgfortran8iWe0Up28Yol.o:./test.f90:29: more undefined references to `.BSS3' follow
/tmp/pgfortran8iWe0Up28Yol.o: In function `..cuda_fortran_constructor_1':
./test.f90:29: undefined reference to `f_'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.STATICS3'
./test.f90:29: undefined reference to `.BSS3'
Any idea why this is happening and how it can be resolved?