| 1 |
! { dg-do run { target { ! offload_target_nvptx } } } |
| 2 |
! { dg-do compile { target offload_target_nvptx } } |
| 3 |
|
| 4 |
program test |
| 5 |
implicit none |
| 6 |
|
| 7 |
integer, parameter :: N = 100 |
| 8 |
integer :: x(N), y(N), z(N) |
| 9 |
integer :: i |
| 10 |
|
| 11 |
do i = 1, N |
| 12 |
x(i) = i; |
| 13 |
y(i) = -i; |
| 14 |
end do |
| 15 |
|
| 16 |
call f (x, y, z) |
| 17 |
|
| 18 |
do i = 1, N |
| 19 |
if (z(i) .ne. x(i) * y(i)) stop 1 |
| 20 |
end do |
| 21 |
|
| 22 |
! ----- |
| 23 |
do i = 1, N |
| 24 |
x(i) = i; |
| 25 |
y(i) = -i; |
| 26 |
end do |
| 27 |
|
| 28 |
call g (x, y, z) |
| 29 |
|
| 30 |
do i = 1, N |
| 31 |
if (z(i) .ne. x(i) * y(i)) stop 1 |
| 32 |
end do |
| 33 |
|
| 34 |
contains |
| 35 |
subroutine f (x, y, z) |
| 36 |
integer :: x(N), y(N), z(N) |
| 37 |
! The following fails as on the host the target side cannot be |
| 38 |
! resolved - and the 'teams' or not status affects how 'target' |
| 39 |
! is called. -> See PR118694, esp. comment 9. |
| 40 |
! Note also the dg-do compile above for offload_target_nvptx |
| 41 |
|
| 42 |
!$omp target map (to: x, y) map(from: z) |
| 43 |
block |
| 44 |
!$omp metadirective & |
| 45 |
!$omp& when(device={arch("nvptx")}: teams loop) & |
| 46 |
!$omp& default(parallel loop) |
| 47 |
do i = 1, N |
| 48 |
z(i) = x(i) * y(i) |
| 49 |
enddo |
| 50 |
end block |
| 51 |
! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 } */ |
| 52 |
end subroutine |
| 53 |
subroutine g (x, y, z) |
| 54 |
integer :: x(N), y(N), z(N) |
| 55 |
|
| 56 |
!$omp target map (to: x, y) map(from: z) |
| 57 |
block |
| 58 |
!$omp metadirective & |
| 59 |
!$omp& when(device={arch("nvptx")}: teams loop) & |
| 60 |
!$omp& default(parallel loop) |
| 61 |
do i = 1, N |
| 62 |
z(i) = x(i) * y(i) |
| 63 |
enddo |
| 64 |
end block |
| 65 |
! { dg-bogus "'target' construct with nested 'teams' construct contains directives outside of the 'teams' construct" "PR118694" { xfail offload_target_nvptx } .-9 } */ |
| 66 |
!$omp end target |
| 67 |
end subroutine |
| 68 |
end program |