xref: /llvm-project/offload/test/api/omp_get_num_devices.c (revision 330d8983d25d08580fc1642fea48b2473f47a9da)
1 // RUN: %libomptarget-compile-run-and-check-generic
2 
3 #include <omp.h>
4 #include <stdio.h>
5 
test_omp_get_num_devices()6 int test_omp_get_num_devices() {
7   /* checks that omp_get_num_devices() > 0 */
8   int num_devices = omp_get_num_devices();
9   printf("num_devices = %d\n", num_devices);
10 
11 #pragma omp target
12   {}
13 
14   return (num_devices > 0);
15 }
16 
main()17 int main() {
18   int i;
19   int failed = 0;
20 
21   if (!test_omp_get_num_devices()) {
22     failed++;
23   }
24   if (failed)
25     printf("FAIL\n");
26   else
27     printf("PASS\n");
28   return failed;
29 }
30 
31 // CHECK: PASS
32