1// RUN: %libomptarget-compilexx-run-and-check-generic
2// RUN: %libomptarget-compileoptxx-run-and-check-generic
3
4// FIXME: This is a bug in host offload, this should run fine.
5// UNSUPPORTED: aarch64-unknown-linux-gnu
6// UNSUPPORTED: aarch64-unknown-linux-gnu-LTO
7// UNSUPPORTED: x86_64-pc-linux-gnu
8// UNSUPPORTED: x86_64-pc-linux-gnu-LTO
9// UNSUPPORTED: s390x-ibm-linux-gnu
10// UNSUPPORTED: s390x-ibm-linux-gnu-LTO
11
12#include <iostream>
13#include <vector>
14
15#define N 8
16
17int main() {
18 std::vector<int> avec(N);
19 int *a = avec.data();
20#pragma omp parallel for
21 for (int i = 0; i < N; i++) {
22 a[i] = 0;
23#pragma omp target teams distribute parallel for reduction(+ : a[i])
24 for (int j = 0; j < N; j++)
25 a[i] += 1;
26 }
27
28 // CHECK: 8
29 // CHECK: 8
30 // CHECK: 8
31 // CHECK: 8
32 // CHECK: 8
33 // CHECK: 8
34 // CHECK: 8
35 // CHECK: 8
36 for (int i = 0; i < N; i++)
37 std::cout << a[i] << std::endl;
38}
39

source code of offload/test/offloading/parallel_target_teams_reduction.cpp