| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
program main |
| 4 |
implicit none |
| 5 |
integer, allocatable, dimension(:) :: AA, BB, CC, DD |
| 6 |
integer :: i, N = 20 |
| 7 |
|
| 8 |
allocate(BB(N)) |
| 9 |
AA = [(i, i=1,N)] |
| 10 |
|
| 11 |
!$omp target enter data map(alloc: BB) |
| 12 |
!$omp target enter data map(to: AA) |
| 13 |
|
| 14 |
!$omp target |
| 15 |
BB = 3 * AA |
| 16 |
!$omp end target |
| 17 |
|
| 18 |
!$omp target exit data map(delete: AA) |
| 19 |
!$omp target exit data map(from: BB) |
| 20 |
|
| 21 |
if (any (BB /= [(3*i, i=1,N)])) stop 1 |
| 22 |
if (any (AA /= [(i, i=1,N)])) stop 2 |
| 23 |
|
| 24 |
|
| 25 |
CC = 31 * BB |
| 26 |
DD = [(-i, i=1,N)] |
| 27 |
|
| 28 |
!$omp target enter data map(to: CC) map(alloc: DD) |
| 29 |
|
| 30 |
!$omp target |
| 31 |
DD = 5 * CC |
| 32 |
!$omp end target |
| 33 |
|
| 34 |
!$omp target exit data map(delete: CC) map(from: DD) |
| 35 |
|
| 36 |
if (any (CC /= [(31*3*i, i=1,N)])) stop 3 |
| 37 |
if (any (DD /= [(31*3*5*i, i=1,N)])) stop 4 |
| 38 |
end |