Debian Codegraph @

libgomp/testsuite/libgomp.fortran/target-present-1.f90

raw
1 program main
2 implicit none
3 integer, parameter :: N = 100
4 integer :: a(N), b(N), c(N), i
5
6 do i = 1, N
7 a(i) = i * 2
8 b(i) = i * 3 + 1
9 end do
10
11 !$omp target enter data map (alloc: a)
12 ! a has already been allocated, so this should be okay.
13 !$omp target map (present, to: a)
14 do i = 1, N
15 c(i) = a(i)
16 end do
17 !$omp end target
18
19 print *, "CheCKpOInT"
20 ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" }
21
22 ! b has not been allocated, so this should result in an error.
23 ! { dg-output "libgomp: present clause: not present on the device \\(addr: 0x\[0-9a-f\]+, size: \[0-9\]+ \\(0x\[0-9a-f\]+\\), dev: \[0-9\]+\\\)" { target offload_device_nonshared_as } }
24 ! { dg-shouldfail "present error triggered" { offload_device_nonshared_as } }
25 !$omp target map (present, to: b)
26 do i = 1, N
27 c(i) = c(i) + b(i)
28 end do
29 !$omp end target
30 !$omp target exit data map (from: c)
31 end program