gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c
Andrew Stubbs 6687d13a87 Rename acc_device_gcn to acc_device_radeon
2020-01-17  Andrew Stubbs  <ams@codesourcery.com>

	libgomp/
	* config/accel/openacc.f90 (openacc_kinds): Rename acc_device_gcn to
	acc_device_radeon.
	(openacc): Likewise.
	* openacc.f90 (openacc_kinds): Likewise.
	(openacc): Likewise.
	* openacc.h (acc_device_t): Likewise.
	* openacc_lib.h: Likewise.
	* testsuite/lib/libgomp.exp
	(check_effective_target_openacc_amdgcn_accel_present): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-init-1.c
	(cb_compute_construct_end): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-kernels-1.c
	(cb_enqueue_launch_start): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/acc_prof-parallel-1.c
	(cb_enter_data_end): Likewise.
	(cb_exit_data_start): Likewise.
	(cb_exit_data_end): Likewise.
	(cb_compute_construct_end): Likewise.
	(cb_enqueue_launch_start): Likewise.
	(cb_enqueue_launch_end): Likewise.
	* testsuite/libgomp.oacc-c-c++-common/asyncwait-nop-1.c
	(main): Likewise.
2020-01-17 18:11:52 +00:00

78 lines
1.6 KiB
C

/* Several of the async/wait combinations invoked here are no-ops -- they don't
effect anything, but are still valid.
This doesn't verify that the asynchronous operations synchronize correctly,
but just verifies that we don't refuse any variants. */
#undef NDEBUG
#include <assert.h>
#include <openacc.h>
int values[] = { acc_async_sync,
acc_async_noval,
0,
1,
2,
36,
1982, };
const size_t values_n = sizeof values / sizeof values[0];
int
main ()
{
/* Explicitly initialize: it's not clear whether the following OpenACC
runtime library calls implicitly initialize;
<https://github.com/OpenACC/openacc-spec/issues/102>. */
acc_device_t d;
#if defined ACC_DEVICE_TYPE_nvidia
d = acc_device_nvidia;
#elif defined ACC_DEVICE_TYPE_gcn
d = acc_device_radeon;
#elif defined ACC_DEVICE_TYPE_host
d = acc_device_host;
#else
# error Not ported to this ACC_DEVICE_TYPE
#endif
acc_init (d);
for (size_t i = 0; i < values_n; ++i)
assert (acc_async_test (values[i]) == 1);
for (size_t i = 0; i < values_n; ++i)
{
#pragma acc parallel wait (values[i])
;
#pragma acc wait (values[i])
acc_wait (values[i]);
}
for (size_t i = 0; i < values_n; ++i)
{
for (size_t j = 0; j < values_n; ++j)
{
#pragma acc parallel wait (values[i]) async (values[j])
;
#pragma acc wait (values[i]) async (values[j])
acc_wait_async (values[i], values[j]);
}
}
for (size_t i = 0; i < values_n; ++i)
{
#pragma acc parallel wait async (values[i])
;
#pragma acc wait async (values[i])
acc_wait_all_async (values[i]);
}
/* Clean up. */
acc_wait_all ();
return 0;
}