Debian Codegraph @

libgomp/testsuite/libgomp.oacc-fortran/acc_on_device-1-1.f90

raw
1 ! { dg-do run }
2 ! { dg-additional-options "-cpp" }
3
4 ! Disable the acc_on_device builtin; we want to test the libgomp library function.
5 ! { dg-additional-options -fno-builtin-acc_on_device }
6
7 ! { dg-additional-options "-fopt-info-all-omp" }
8 ! { dg-additional-options "--param=openacc-privatization=noisy" }
9 ! { dg-additional-options "-foffload=-fopt-info-all-omp" }
10 ! { dg-additional-options "-foffload=--param=openacc-privatization=noisy" }
11 ! for testing/documenting aspects of that functionality.
12
13 use openacc
14 implicit none
15
16 ! Host.
17
18 if (.not. acc_on_device (acc_device_none)) STOP 1
19 if (.not. acc_on_device (acc_device_host)) STOP 2
20 if (acc_on_device (acc_device_not_host)) STOP 3
21 if (acc_on_device (acc_device_nvidia)) STOP 4
22 if (acc_on_device (acc_device_radeon)) STOP 4
23
24
25 ! Host via offloading fallback mode.
26
27 !$acc parallel if(.false.)
28 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target *-*-* } .-1 }
29 !TODO Unhandled 'CONST_DECL' instances for constant arguments in 'acc_on_device' calls.
30 if (.not. acc_on_device (acc_device_none)) STOP 5
31 if (.not. acc_on_device (acc_device_host)) STOP 6
32 if (acc_on_device (acc_device_not_host)) STOP 7
33 if (acc_on_device (acc_device_nvidia)) STOP 8
34 if (acc_on_device (acc_device_radeon)) STOP 8
35 !$acc end parallel
36
37
38 #if !ACC_DEVICE_TYPE_host
39
40 ! Offloaded.
41
42 !$acc parallel
43 ! { dg-note {variable 'C\.[0-9]+' declared in block potentially has improper OpenACC privatization level: 'const_decl'} "TODO" { target { ! openacc_host_selected } } .-1 }
44 if (acc_on_device (acc_device_none)) STOP 9
45 if (acc_on_device (acc_device_host)) STOP 10
46 if (.not. acc_on_device (acc_device_not_host)) STOP 11
47 #if ACC_DEVICE_TYPE_nvidia
48 if (.not. acc_on_device (acc_device_nvidia)) STOP 12
49 #else
50 if (acc_on_device (acc_device_nvidia)) STOP 13
51 #endif
52 #if ACC_DEVICE_TYPE_radeon
53 if (.not. acc_on_device (acc_device_radeon)) STOP 14
54 #else
55 if (acc_on_device (acc_device_radeon)) STOP 15
56 #endif
57 !$acc end parallel
58
59 #endif
60
61 end