Files
clang-p2996/openmp/libomptarget/test/mapping/reduction_implicit_map.cpp
Joseph Huber 586fc5999b [Libomptarget][NFC] clang-format the libomptarget OpenMP tests
Summary:
Recent changes to clang-format improved the handling of OpenMP pragmas.
Clean up the existing libomptarget tests.
2022-10-19 08:57:27 -05:00

23 lines
552 B
C++

// RUN: %libomptarget-compilexx-run-and-check-generic
#include <stdio.h>
void sum(int *input, int size, int *output) {
#pragma omp target teams distribute parallel for reduction(+ : output[0]) \
map(to : input[0 : size])
for (int i = 0; i < size; i++)
output[0] += input[i];
}
int main() {
const int size = 100;
int *array = new int[size];
int result = 0;
for (int i = 0; i < size; i++)
array[i] = i + 1;
sum(array, size, &result);
// CHECK: Result=5050
printf("Result=%d\n", result);
delete[] array;
return 0;
}