1 /* Check if different occurences of the reduction clause on 2 OpenACC loop nests will compile. */ 3 foo(int N)4int foo (int N) 5 { 6 int a = 0, b = 0, c = 0, d = 0, e = 0; 7 8 #pragma acc parallel 9 { 10 #pragma acc loop 11 for (int i = 0; i < N; i++) 12 { 13 #pragma acc loop reduction(+:a) 14 for (int j = 0; j < N; j++) 15 a += 1; 16 } 17 } 18 19 #pragma acc parallel 20 { 21 #pragma acc loop reduction(+:b) 22 for (int i = 0; i < N; i++) 23 { 24 #pragma acc loop 25 for (int j = 0; j < N; j++) 26 b += 1; 27 } 28 } 29 30 #pragma acc parallel 31 { 32 #pragma acc loop reduction(+:c) 33 for (int i = 0; i < N; i++) 34 { 35 #pragma acc loop reduction(+:c) 36 for (int j = 0; j < N; j++) 37 c += 1; 38 } 39 } 40 41 #pragma acc parallel loop 42 for (int i = 0; i < N; i++) 43 { 44 #pragma acc loop reduction(+:d) 45 for (int j = 0; j < N; j++) 46 d += 1; 47 } 48 49 #pragma acc parallel loop reduction(+:e) 50 for (int i = 0; i < N; i++) 51 { 52 #pragma acc loop reduction(+:e) 53 for (int j = 0; j < N; j++) 54 e += 1; 55 } 56 57 return a + b + c + d + e; 58 } 59