8 integer, target
:: a_3d_i(10, 10, 10)
9 complex a_3d_c(10, 10, 10)
10 real a_3d_r(10, 10, 10)
15 integer, parameter :: i_size
= sizeof (i
)
16 integer, parameter :: c_size
= sizeof (c
)
17 integer, parameter :: r_size
= sizeof (r
)
19 if (acc_get_num_devices (acc_device_nvidia
) .eq
. 0) call exit
21 call acc_init (acc_device_nvidia
)
23 call set3d (.FALSE
., a_3d_i
, a_3d_c
, a_3d_r
)
25 call acc_copyin (a_3d_i
)
26 call acc_copyin (a_3d_c
)
27 call acc_copyin (a_3d_r
)
29 if (acc_is_present (a_3d_i
) .neqv
. .TRUE
.) call abort
30 if (acc_is_present (a_3d_c
) .neqv
. .TRUE
.) call abort
31 if (acc_is_present (a_3d_r
) .neqv
. .TRUE
.) call abort
36 if (acc_is_present (a_3d_i(i
, j
, k
), i_size
) .neqv
. .TRUE
.) call abort
37 if (acc_is_present (a_3d_c(i
, j
, k
), i_size
) .neqv
. .TRUE
.) call abort
38 if (acc_is_present (a_3d_r(i
, j
, k
), i_size
) .neqv
. .TRUE
.) call abort
43 call acc_shutdown (acc_device_nvidia
)
47 subroutine set3d (clear
, a_i
, a_c
, a_r
)
49 integer, dimension (:,:,:), intent (inout
) :: a_i
50 complex, dimension (:,:,:), intent (inout
) :: a_c
51 real, dimension (:,:,:), intent (inout
) :: a_r
54 integer lb1
, ub1
, lb2
, ub2
, lb3
, ub3
70 a_c(i
, j
, k
) = cmplx (0.0, 0.0)
74 a_c(i
, j
, k
) = cmplx (i
, j
)