Dear All,
Could you check if the following is the proper way to use the “data” directive ?
Here are two source codes. “mod.F90” and “main.F90”
In the file “main.F90”, the subroutines “alloc_on_device()” and “free_on_device()”
are called. And these subroutines are declared in the file “mod.F90”.
In the subroutine “alloc_on_device()”, the directive “enter data” is declared.
In the subroutine “free_on_device()”, the directive “exit data” is declared.
These subroutines are passed the array “x”.
In these subroutines, the assumed-shape "… dimension(:,:) … " are declared.
On the OpenACC standard, there seems to be no problem to use the assumed-size.
However I don’t know if the assumed-shape is available as follows.
------------------------------ mod.F90 ---------------------------------------------
module test
implicit none
contains
subroutine alloc_on_device(x,i,j)
integer(kind=4) :: i,j
integer(kind=4),dimension(:,:),intent(in) :: x
!$acc enter data create(x(1:i,1:j))
end subroutine alloc_on_device
subroutine free_on_device(x,i,j)
integer(kind=4) :: i,j
integer(kind=4),dimension(:,:),intent(in) :: x
!$acc exit data delete(x(1:i,1:j))
end subroutine free_on_device
end module test
-------------------------- main.F90 -----------------------------------------------------
program OpenACC_test
use test
implicit none
integer(kind=4),parameter :: n = 1024
integer(kind=4),dimension(n,n) :: a