1 // Unonptimized, we need 24000000 bytes heap
2 // RUN: %libomptarget-compilexx-generic
3 // RUN: env LIBOMPTARGET_HEAP_SIZE=24000000 \
4 // RUN: %libomptarget-run-generic 2>&1 | %fcheck-generic
5 // RUN: %libomptarget-compileoptxx-run-and-check-generic
9 template <typename LOOP_BODY
>
10 inline void forall(int Begin
, int End
, LOOP_BODY LoopBody
) {
11 #pragma omp target parallel for schedule(static)
12 for (int I
= Begin
; I
< End
; ++I
) {
20 // Demonstration of the RAJA abstraction using lambdas
21 // Requires data mapping onto the target section
24 double A
[N
], B
[N
], C
[N
];
26 for (int I
= 0; I
< N
; I
++) {
32 #pragma omp target data map(tofrom : C[0 : N]) map(to : A[0 : N], B[0 : N])
34 forall(0, N
, [&](int I
) { C
[I
] += A
[I
] + B
[I
]; });
38 for (int I
= 0; I
< N
; I
++) {
40 std::cout
<< "Failed at " << I
<< " with val " << C
[I
] << std::endl
;
47 std::cout
<< "Failed" << std::endl
;
49 std::cout
<< "Succeeded" << std::endl
;