brintos

brintos / llvm-project-archived public Read only

0
0
Text · 561 B · b546d73 Raw
32 lines · c
1// RUN: %libomptarget-compile-generic && \2// RUN: %libomptarget-run-generic3 4#include <omp.h>5#include <stdio.h>6#include <stdlib.h>7 8int main(int argc, char *argv[]) {9 10  int num_devices = omp_get_num_devices();11 12  // No target devices, just return13  if (num_devices == 0) {14    printf("PASS\n");15    return 0;16  }17 18  double sum = 999;19  double A = 311;20 21#pragma omp taskgroup task_reduction(+ : sum)22  {23#pragma omp target map(to : A) in_reduction(+ : sum) device(0) nowait24    { sum += A; }25  }26 27  printf("PASS\n");28  return EXIT_SUCCESS;29}30 31// CHECK: PASS32