brintos

brintos / llvm-project-archived public Read only

0
0
Text · 684 B · d6486f6 Raw
34 lines · cpp
1// RUN: %libomptarget-compilexx-run-and-check-generic2// RUN: %libomptarget-compileoptxx-run-and-check-generic3 4// FIXME: This is a bug in host offload, this should run fine.5// REQUIRES: gpu6 7#include <iostream>8#include <vector>9 10#define N 811 12int main() {13  std::vector<int> avec(N);14  int *a = avec.data();15#pragma omp parallel for16  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: 824  // CHECK: 825  // CHECK: 826  // CHECK: 827  // CHECK: 828  // CHECK: 829  // CHECK: 830  // CHECK: 831  for (int i = 0; i < N; i++)32    std::cout << a[i] << std::endl;33}34