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