1! { dg-do run }
2! { dg-additional-options "-cpp" }
3!
4! TODO: Have to disable the acc_on_device builtin for we want to test the
5! libgomp library function?  The command line option
6! '-fno-builtin-acc_on_device' is valid for C/C++/ObjC/ObjC++ but not for
7! Fortran.
8
9use openacc
10implicit none
11
12! Host.
13
14if (.not. acc_on_device (acc_device_none)) STOP 1
15if (.not. acc_on_device (acc_device_host)) STOP 2
16if (acc_on_device (acc_device_not_host)) STOP 3
17if (acc_on_device (acc_device_nvidia)) STOP 4
18
19
20! Host via offloading fallback mode.
21
22!$acc parallel if(.false.)
23if (.not. acc_on_device (acc_device_none)) STOP 5
24if (.not. acc_on_device (acc_device_host)) STOP 6
25if (acc_on_device (acc_device_not_host)) STOP 7
26if (acc_on_device (acc_device_nvidia)) STOP 8
27!$acc end parallel
28
29
30#if !ACC_DEVICE_TYPE_host
31
32! Offloaded.
33
34!$acc parallel
35if (acc_on_device (acc_device_none)) STOP 9
36if (acc_on_device (acc_device_host)) STOP 10
37if (.not. acc_on_device (acc_device_not_host)) STOP 11
38#if ACC_DEVICE_TYPE_nvidia
39if (.not. acc_on_device (acc_device_nvidia)) STOP 12
40#else
41if (acc_on_device (acc_device_nvidia)) STOP 13
42#endif
43!$acc end parallel
44
45#endif
46
47end
48