|
11 | 11 | ! RUN: %libomptarget-compile-fortran-run-and-check-generic
|
12 | 12 | module test_0
|
13 | 13 | implicit none
|
14 |
| - INTEGER :: sp(10) = (/0,0,0,0,0,0,0,0,0,0/) |
15 |
| - !$omp declare target link(sp) |
| 14 | + INTEGER :: arr1(10) = (/0,0,0,0,0,0,0,0,0,0/) |
| 15 | + INTEGER :: arr2(10) = (/0,0,0,0,0,0,0,0,0,0/) |
| 16 | + !$omp declare target link(arr1) enter(arr2) |
16 | 17 | end module test_0
|
17 | 18 |
|
18 |
| -program main |
| 19 | +subroutine test_with_array_link_and_tofrom() |
19 | 20 | use test_0
|
20 | 21 | integer :: i = 1
|
21 | 22 | integer :: j = 11
|
22 |
| -!$omp target map(tofrom:sp, i, j) |
| 23 | +!$omp target map(tofrom:arr1, i, j) |
23 | 24 | do while (i <= j)
|
24 |
| - sp(i) = i; |
| 25 | + arr1(i) = i; |
25 | 26 | i = i + 1
|
26 | 27 | end do
|
27 | 28 | !$omp end target
|
28 | 29 |
|
29 |
| -PRINT *, sp(:) |
| 30 | +! CHECK: 1 2 3 4 5 6 7 8 9 10 |
| 31 | +PRINT *, arr1(:) |
| 32 | +end subroutine test_with_array_link_and_tofrom |
30 | 33 |
|
31 |
| -end program |
| 34 | +subroutine test_with_array_link_only() |
| 35 | +use test_0 |
| 36 | +integer :: i = 1 |
| 37 | +integer :: j = 11 |
| 38 | +!$omp target map(i, j) |
| 39 | + do while (i <= j) |
| 40 | + arr1(i) = i + 1; |
| 41 | + i = i + 1 |
| 42 | + end do |
| 43 | +!$omp end target |
32 | 44 |
|
33 |
| -! CHECK: 1 2 3 4 5 6 7 8 9 10 |
| 45 | +! CHECK: 2 3 4 5 6 7 8 9 10 11 |
| 46 | +PRINT *, arr1(:) |
| 47 | +end subroutine test_with_array_link_only |
| 48 | + |
| 49 | +subroutine test_with_array_enter_only() |
| 50 | +use test_0 |
| 51 | +integer :: i = 1 |
| 52 | +integer :: j = 11 |
| 53 | +!$omp target map(i, j) |
| 54 | + do while (i <= j) |
| 55 | + arr2(i) = i + 1; |
| 56 | + i = i + 1 |
| 57 | + end do |
| 58 | +!$omp end target |
| 59 | + |
| 60 | +! CHECK: 0 0 0 0 0 0 0 0 0 0 |
| 61 | +PRINT *, arr2(:) |
| 62 | +end subroutine test_with_array_enter_only |
| 63 | + |
| 64 | + |
| 65 | +program main |
| 66 | +call test_with_array_link_and_tofrom() |
| 67 | +call test_with_array_link_only() |
| 68 | +call test_with_array_enter_only() |
| 69 | +end program |
0 commit comments