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 // REQUIRES: gpu 6 7 #include <iostream> 8 #include <vector> 9 10 #define N 8 11 main()12int main() { 13 std::vector<int> avec(N); 14 int *a = avec.data(); 15 #pragma omp parallel for 16 for (int i = 0; i < N; i++) { 17 a[i] = 0; 18 #pragma omp target teams distribute parallel for reduction(+ : a[i]) 19 for (int j = 0; j < N; j++) 20 a[i] += 1; 21 } 22 23 // CHECK: 8 24 // CHECK: 8 25 // CHECK: 8 26 // CHECK: 8 27 // CHECK: 8 28 // CHECK: 8 29 // CHECK: 8 30 // CHECK: 8 31 for (int i = 0; i < N; i++) 32 std::cout << a[i] << std::endl; 33 } 34