blob: 064c6f5f2d83af7a090efe9a29f17ed1d278ac65 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
/* Disable the acc_on_device builtin; we want to test the libgomp library
function. */
/* { dg-additional-options "-fno-builtin-acc_on_device" } */
#include <stdlib.h>
#include <openacc.h>
int
main (int argc, char *argv[])
{
/* Host. */
{
if (!acc_on_device (acc_device_none))
abort ();
if (!acc_on_device (acc_device_host))
abort ();
if (acc_on_device (acc_device_not_host))
abort ();
if (acc_on_device (acc_device_nvidia))
abort ();
if (acc_on_device (acc_device_radeon))
abort ();
}
/* Host via offloading fallback mode. */
#pragma acc parallel if(0)
{
if (!acc_on_device (acc_device_none))
abort ();
if (!acc_on_device (acc_device_host))
abort ();
if (acc_on_device (acc_device_not_host))
abort ();
if (acc_on_device (acc_device_nvidia))
abort ();
if (acc_on_device (acc_device_radeon))
abort ();
}
#if !ACC_DEVICE_TYPE_host
/* Offloaded. */
#pragma acc parallel
{
if (acc_on_device (acc_device_none))
abort ();
if (acc_on_device (acc_device_host))
abort ();
if (!acc_on_device (acc_device_not_host))
abort ();
#if ACC_DEVICE_TYPE_nvidia
if (!acc_on_device (acc_device_nvidia))
abort ();
#else
if (acc_on_device (acc_device_nvidia))
abort ();
#endif
#if ACC_DEVICE_TYPE_radeon
if (!acc_on_device (acc_device_radeon))
abort ();
#else
if (acc_on_device (acc_device_radeon))
abort ();
#endif
}
#endif
return 0;
}
|