mirror of
https://github.com/autc04/Retro68.git
synced 2024-12-11 03:52:59 +00:00
31 lines
442 B
C
31 lines
442 B
C
const int n = 100;
|
|
|
|
// Check async over parallel construct with reduction
|
|
|
|
int
|
|
async_sum (int c)
|
|
{
|
|
int s = 0;
|
|
|
|
#pragma acc parallel loop num_gangs (10) gang reduction (+:s) async
|
|
for (int i = 0; i < n; i++)
|
|
s += i+c;
|
|
|
|
#pragma acc wait
|
|
return s;
|
|
}
|
|
|
|
int
|
|
main()
|
|
{
|
|
int result = 0;
|
|
|
|
for (int i = 0; i < n; i++)
|
|
result += i+1;
|
|
|
|
if (async_sum (1) != result)
|
|
__builtin_abort ();
|
|
|
|
return 0;
|
|
}
|