I have tried compiling the following code with nvhpc/21.3 to run on an Nvidia v100, but the code bombs out. So nvhpc does not support fortran automatic arrays, but does the OpenMP standard support them?
module test_mod
contains
subroutine saxpy(i,n,s)
integer :: i,n
real(8), parameter :: p=0.5
real(8), dimension(n,n) :: a,b,c ! automatic arrays
real(8) :: s
!$omp declare target
a(i,:) = 1.0d0
b(i,:) = 2.0d0
c(i,:) = 0.0d0
do j=1,n
c(i,j) = a(i,j) + p*b(i,j)
end do
s=c(i,1)
end subroutine
end module
program test
use test_mod
integer, parameter :: n=100
integer :: i
real(8) :: s
!$omp target teams distribute parallel do map(from:s)
do i=1,n
call saxpy(i,n,s)
end do
print*,'%test_omp, ',s
end program