Files
clang-p2996/openmp/libomptarget/test/api/omp_get_device_num.c
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

32 lines
556 B
C

// RUN: %libomptarget-compile-run-and-check-generic
#include <omp.h>
#include <stdio.h>
int test_omp_get_device_num() {
/* checks that omp_get_device_num() == omp_get_num_devices() in the host */
int device_num = omp_get_device_num();
printf("device_num = %d\n", device_num);
#pragma omp target
{}
return (device_num == omp_get_num_devices());
}
int main() {
int i;
int failed = 0;
if (!test_omp_get_device_num()) {
failed++;
}
if (failed)
printf("FAIL\n");
else
printf("PASS\n");
return failed;
}
// CHECK: PASS