Many tests in the `offload` project have requirements defined by which targets are not supported rather than which platforms are supported. This patch aims to streamline the requirement definitions by adding four new feature tags: `host`, `gpu`, `amdgpu`, and `nvidiagpu`.
37 lines
800 B
C++
37 lines
800 B
C++
// RUN: %libomptarget-compilexx-run-and-check-generic
|
|
|
|
// REQUIRES: gpu
|
|
// UNSUPPORTED: nvptx64-nvidia-cuda
|
|
// UNSUPPORTED: nvptx64-nvidia-cuda-LTO
|
|
// UNSUPPORTED: amdgcn-amd-amdhsa
|
|
|
|
#include <omp.h>
|
|
#include <stdio.h>
|
|
|
|
#define N 1000000
|
|
|
|
int A[N];
|
|
int main() {
|
|
for (int i = 0; i < N; i++)
|
|
A[i] = 1;
|
|
|
|
int sum[1];
|
|
sum[0] = 0;
|
|
|
|
#pragma omp target teams distribute parallel for num_teams(256) \
|
|
schedule(static, 1) map(to \
|
|
: A[:N]) map(tofrom \
|
|
: sum[:1])
|
|
{
|
|
for (int i = 0; i < N; i++) {
|
|
#pragma omp critical
|
|
{ sum[0] += A[i]; }
|
|
}
|
|
}
|
|
|
|
// CHECK: SUM = 1000000
|
|
printf("SUM = %d\n", sum[0]);
|
|
|
|
return 0;
|
|
}
|