3 /* Like imperfect1.c, but enables offloading. */
5 static int f1count
[3], f2count
[3];
6 #pragma omp declare target enter (f1count, f2count)
9 extern void abort (void);
11 extern "C" void abort (void);
14 int f1 (int depth
, int iter
)
21 int f2 (int depth
, int iter
)
28 void s1 (int a1
, int a2
, int a3
)
32 #pragma omp target parallel for collapse(3) map(always, tofrom:f1count, f2count)
33 for (i
= 0; i
< a1
; i
++)
36 for (j
= 0; j
< a2
; j
++)
39 for (k
= 0; k
< a3
; k
++)
62 /* All intervening code at the same depth must be executed the same
64 if (f1count
[0] != f2count
[0]) abort ();
65 if (f1count
[1] != f2count
[1]) abort ();
66 if (f1count
[2] != f2count
[2]) abort ();
68 /* Intervening code must be executed at least as many times as the loop
70 if (f1count
[0] < 3) abort ();
71 if (f1count
[1] < 3 * 4) abort ();
73 /* Intervening code must not be executed more times than the number
74 of logical iterations. */
75 if (f1count
[0] > 3 * 4 * 5) abort ();
76 if (f1count
[1] > 3 * 4 * 5) abort ();
78 /* Check that the innermost loop body is executed exactly the number
79 of logical iterations expected. */
80 if (f1count
[2] != 3 * 4 * 5) abort ();