I modified the f2.f program (which and compiles and runs
as expected) at the following site:
http://www.pgroup.com/lit/articles/insider/v1n1a1.htm.
to:
program main
use accel_lib
integer :: n,n1 ! size of the vector
real,dimension(:),allocatable :: a ! the vector
real,dimension(:),allocatable :: b ! the vector
real,dimension(:),allocatable :: r ! the results
real,dimension(:),allocatable :: e ! expected results
integer :: i
integer :: c0, c1, c2, c3, cgpu, chost
character(10) :: arg1
if( iargc() .gt. 0 )then
call getarg( 1, arg1 )
read(arg1,‘(i10)’) n
else
n = 100000
endif
n1 = 1
if( n .le. 0 ) n = 100000
allocate(a(n))
allocate(b(n))
allocate(r(n))
allocate(e(n))
do i = 1,n
a(i) = i2.0
b(i) = i2.0
enddo
call system_clock( count=c1 )
!call acc_init( acc_device_nvidia )
!$acc region
do i = n1,n
r(i) = sin(a(i)) ** 2 + cos(b(i)) ** 2
enddo
!$acc end region
call multiply1()
call system_clock( count=c2 )
cgpu = c2 - c1
do i = 1,n
e(i) = sin(a(i)) ** 2 + cos(a(i)) ** 2
enddo
call system_clock( count=c3 )
chost = c3 - c2
! check the results
do i = 1,n
if( abs(r(i) - e(i)) .gt. 0.000001 )then
print *, i, r(i), e(i)
endif
enddo
print *, n, ’ iterations completed’
print *, cgpu, ’ microseconds on GPU’
print *, chost, ’ microseconds on host’
contains
subroutine multiply1()
!call acc_init( acc_device_nvidia )
!$acc region
do i = n1,n
r(i) = sin(a(i)) ** 2 + cos(b(i)) ** 2
enddo
!$acc end region
end subroutine
end program
When I compile this I get the following error:main:
29, No parallel kernels found, accelerator region ignored
31, Accelerator restriction: induction variable live-out from loop: i
32, Accelerator restriction: induction variable live-out from loop: i
Accelerator restriction: induction variable live-out from loop: .dY0002
multiply1:
57, No parallel kernels found, accelerator region ignored
59, Accelerator restriction: induction variable live-out from loop: i
60, Accelerator restriction: induction variable live-out from loop: i
Accelerator restriction: induction variable live-out from loop: .dY0005
Any one knows what is going on?