| 1 | // RUN: %libomptarget-compile-run-and-check-generic |
| 2 | |
| 3 | #include <omp.h> |
| 4 | #include <stdio.h> |
| 5 | |
| 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(format: "num_devices = %d\n" , num_devices); |
| 10 | |
| 11 | #pragma omp target |
| 12 | {} |
| 13 | |
| 14 | return (num_devices > 0); |
| 15 | } |
| 16 | |
| 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(format: "FAIL\n" ); |
| 26 | else |
| 27 | printf(format: "PASS\n" ); |
| 28 | return failed; |
| 29 | } |
| 30 | |
| 31 | // CHECK: PASS |
| 32 | |