Update 'Q' constraint documentation.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c-c++-common / asyncwait-nop-1.c
blob840052fec12252668bbd4bcdc5e1ab3cdad03d3c
1 /* Several of the async/wait combinations invoked here are no-ops -- they don't
2 effect anything, but are still valid.
4 This doesn't verify that the asynchronous operations synchronize correctly,
5 but just verifies that we don't refuse any variants. */
7 #undef NDEBUG
8 #include <assert.h>
9 #include <openacc.h>
11 int values[] = { acc_async_sync,
12 acc_async_noval,
16 36,
17 1982, };
18 const size_t values_n = sizeof values / sizeof values[0];
20 int
21 main ()
23 /* Explicitly initialize: it's not clear whether the following OpenACC
24 runtime library calls implicitly initialize;
25 <https://github.com/OpenACC/openacc-spec/issues/102>. */
26 acc_device_t d;
27 #if defined ACC_DEVICE_TYPE_nvidia
28 d = acc_device_nvidia;
29 #elif defined ACC_DEVICE_TYPE_gcn
30 d = acc_device_gcn;
31 #elif defined ACC_DEVICE_TYPE_host
32 d = acc_device_host;
33 #else
34 # error Not ported to this ACC_DEVICE_TYPE
35 #endif
36 acc_init (d);
39 for (size_t i = 0; i < values_n; ++i)
40 assert (acc_async_test (values[i]) == 1);
43 for (size_t i = 0; i < values_n; ++i)
45 #pragma acc parallel wait (values[i])
47 #pragma acc wait (values[i])
48 acc_wait (values[i]);
52 for (size_t i = 0; i < values_n; ++i)
54 for (size_t j = 0; j < values_n; ++j)
56 #pragma acc parallel wait (values[i]) async (values[j])
58 #pragma acc wait (values[i]) async (values[j])
59 acc_wait_async (values[i], values[j]);
64 for (size_t i = 0; i < values_n; ++i)
66 #pragma acc parallel wait async (values[i])
68 #pragma acc wait async (values[i])
69 acc_wait_all_async (values[i]);
73 /* Clean up. */
74 acc_wait_all ();
76 return 0;