I am working on DSL framework which helps to generate OpenMP offload version

I am currently working on Fortran 90 code generation and has some doubts related to handling constants and local arrays inside the OpenMP offload kernel

curently i am doing following

```
MODULE OPS_CONSTANTS
integer :: imax, jmax
real(8) :: pi = 2.0_8 * ASIN(1.0_8)
!$OMP DECLARE TARGET(imax)
!$OMP DECLARE TARGET(jmax)
!$OMP DECLARE TARGET(pi)
END MODULE OPS_CONSTANTS
```

Then in main program

```
PROGRAM laplace
use OPS_CONSTANTS
use APPLY_STENCIL_KERNEL_MODULE
imax = 4094
jmax = 4094
! Allocate array A and Anew on Device
!$OMP TARGET ENTER DATA MAP(TO:imax)
!$OMP TARGET UPDATE TO(imax)
!$OMP TARGET ENTER DATA MAP(TO:jmax)
!$OMP TARGET UPDATE TO(jmax)
!$OMP TARGET ENTER DATA MAP(TO:pi)
!$OMP TARGET UPDATE TO(pi)
CALL apply_stencil_kernel_host(A,Anew,error)
END PROGRAM laplace
```

and in Apply Stencil Kernel

```
MODULE APPLY_STENCIL_KERNEL_MODULE
USE OPS_CONSTANTS
USE, INTRINSIC :: ISO_C_BINDING
IMPLICIT NONE
!$OMP DECLARE TARGET(xdim1_apply_stencil_kernel)
INTEGER(KIND=4) :: xdim1_apply_stencil_kernel
SUBROUTINE apply_stencil_kernel_host(A, Anew, error)
REAL(KIND=8), DIMENSION(:,:), INTENT(IN) :: A
REAL(KIND=8), DIMENSION(:,:) :: Anew
REAL(KIND=8) :: error
INTEGER(KIND=4) :: n_x, n_y
INTEGER(KIND=4), DIMENSION(2) :: idx_local
xdim1_apply_stencil_kernel = imax
!$OMP TARGET ENTER DATA MAP(TO:xdim1_apply_stencil_kernel)
!$OMP TARGET UPDATE TO(xdim1_apply_stencil_kernel)
!$OMP TARGET DATA MAP(TO:idx_local(1:2))
!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO PRIVATE(n_x,n_y) REDUCTION(MAX:error)
DO n_y = 1, jmax
DO n_x = 1, imax
idx_local = [n_x,n_y]
Anew(n_x,n_y) = 0.25_8 * ( A(n_x+1,n_y) + A(n_x-1,n_y) &
& + A(n_x,-n_y1) + A(n_x,n_y+1) )
! Some code using xdim1_apply_stencil_kernel and idx_local, ONLY READ
END DO
END DO
!$OMP END TARGET TEAMS DISTRIBUTE PARALLEL DO
!$OMP END TARGET DATA
END SUBROUTINE apply_stencil_kernel_host(A, Anew, error)
END MODULE APPLY_STENCIL_KERNEL_MODULE
```

is this correct approach??