public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
* gfortran6 with OpenACC - error
@ 2016-04-26 15:08 Anton Shterenlikht
  2016-04-26 15:16 ` Cesar Philippidis
  0 siblings, 1 reply; 3+ messages in thread
From: Anton Shterenlikht @ 2016-04-26 15:08 UTC (permalink / raw)
  To: fortran

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1305 bytes --]

gfortran  6.0.0 20160410 on linux.
Compiling with *no* -fopenacc works fine,
and the serial program runs as expected.
Compiling with -fopenacc gives an error.
Am I using OpenACC directives wrongly?

newblue4> cat z.f90 
program z
implicit none
integer, parameter :: d1 = 1000, d2 = 1000
real :: tmp( (d1-2) *(d2-2) )
real, allocatable :: arr(:,:), old(:,:)
integer :: i,j,k

! allocate and set all to zero
allocate( arr(d1,d2), source = 0.0 )
allocate( old(d1,d2) )

! set inner cells to random numbers
call random_number(tmp)
arr( 2:d1-1 , 2:d2-1 ) = reshape( tmp, (/ d1-2, d1-2 /) ) 

!$acc data copy(arr)
write (*,*) "before:", sum(abs(arr))

do i=1,1000
  old = arr

!$acc kernels
  do j=2,d1-1
  do k=2,d2-1
    arr(j,k) = 0.25 * ( old(j-1,k) + old(j+1,k) + old(j,k-1) + old(j,k+1) )
  end do
  end do
!$acc end kernels

end do

write (*,*) "after:", sum(abs(arr))

end program z
newblue4> 

newblue4> gfortran -O2 z.f90 -Wall -o gfort-acc.x
newblue4> time ./gfort-acc.x 
 before:   497871.688    
 after:   464004.844    
9.102u 0.006s 0:09.13 99.6%     0+0k 0+0io 0pf+0w
newblue4> 

newblue4> gfortran -fopenacc -O2 z.f90 -Wall -o gfort-acc.x
z.f90:34:3:

 end program z
   1
Error: Unexpected END statement at (1)
f951: Error: Unexpected end of file in ‘z.f90’
newblue4>

Thanks

Anton 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-04-26 15:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-26 15:08 gfortran6 with OpenACC - error Anton Shterenlikht
2016-04-26 15:16 ` Cesar Philippidis
2016-04-26 15:37   ` Anton Shterenlikht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).