Debian Codegraph @

libgomp/testsuite/libgomp.fortran/target-has-device-addr-1.f90

raw
1 program main
2 use omp_lib
3 use iso_c_binding
4 implicit none
5
6 integer, parameter :: N = 40
7 integer :: x, i
8 integer :: y (N)
9 integer :: u (0)
10
11 x = 24
12 !$omp target data map(x) use_device_addr(x)
13 !$omp target has_device_addr(x)
14 x = 42;
15 !$omp end target
16 !$omp end target data
17 if (x /= 42) stop 1
18
19 y = 42
20 !$omp target data map(y) use_device_addr(y)
21 !$omp target has_device_addr(y)
22 y = [(i, i=1, N)]
23 !$omp end target
24 !$omp end target data
25 if (any (y /= [(i, i = 1, N)])) stop 2
26
27 !$omp target data map(y(:N)) use_device_addr(y)
28 !$omp target has_device_addr(y(:N))
29 y = [(i+2, i=1, N)]
30 !$omp end target
31 !$omp end target data
32 if (any (y /= [(i+2, i = 1, N)])) stop 3
33
34 !$omp target data map(y) use_device_addr(y)
35 !$omp target has_device_addr(y(24:))
36 do i = 24, N
37 y(i) = i + 3
38 end do
39 !$omp end target
40 !$omp end target data
41 do i = 24, N
42 if (y(i) /= i + 3) stop 5
43 end do
44
45 !$omp target data map(u) use_device_addr(u)
46 !$omp target has_device_addr(u)
47 !$omp end target
48 !$omp end target data
49
50 end program main