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