32 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2 3#include <omp.h>4#include <stdio.h>5 6int 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 target12 {}13 14 return (num_devices > 0);15}16 17int 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 else27 printf("PASS\n");28 return failed;29}30 31// CHECK: PASS32