ccc8282bab
gcc/ * config/nvptx/nvptx.c (nvptx_goacc_validate_dims): Add checking. libgomp/ * testsuite/libgomp.oacc-fortran/reduction-1.f90: Fix dimensions and reduction copy. * testsuite/libgomp.oacc-fortran/reduction-2.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-3.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-4.f90: Likewise. * testsuite/libgomp.oacc-fortran/reduction-6.f90: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/collapse-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/par-reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-initial-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/reduction-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/parallel-dims.c: New. From-SVN: r229780
47 lines
675 B
C
47 lines
675 B
C
#include <assert.h>
|
|
#include <openacc.h>
|
|
|
|
int
|
|
main (int argc, char *argv[])
|
|
{
|
|
int res, res2 = 0;
|
|
|
|
#if defined(ACC_DEVICE_TYPE_host)
|
|
# define GANGS 1
|
|
#else
|
|
# define GANGS 256
|
|
#endif
|
|
#pragma acc parallel num_gangs(GANGS) copy(res2) async(1)
|
|
{
|
|
#pragma acc atomic
|
|
res2 += 5;
|
|
}
|
|
res = GANGS * 5;
|
|
|
|
acc_wait (1);
|
|
|
|
assert (res == res2);
|
|
#undef GANGS
|
|
|
|
res = res2 = 1;
|
|
|
|
#if defined(ACC_DEVICE_TYPE_host)
|
|
# define GANGS 1
|
|
#else
|
|
# define GANGS 8
|
|
#endif
|
|
#pragma acc parallel num_gangs(GANGS) copy(res2) async(1)
|
|
{
|
|
#pragma acc atomic
|
|
res2 *= 5;
|
|
}
|
|
for (int i = 0; i < GANGS; ++i)
|
|
res *= 5;
|
|
|
|
acc_wait (1);
|
|
|
|
assert (res == res2);
|
|
|
|
return 0;
|
|
}
|