32 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2 3#include <omp.h>4#include <stdio.h>5 6int test_omp_get_device_num() {7 /* checks that omp_get_device_num() == omp_get_num_devices() in the host */8 int device_num = omp_get_device_num();9 printf("device_num = %d\n", device_num);10 11#pragma omp target12 {}13 14 return (device_num == omp_get_num_devices());15}16 17int main() {18 int i;19 int failed = 0;20 21 if (!test_omp_get_device_num()) {22 failed++;23 }24 if (failed)25 printf("FAIL\n");26 else27 printf("PASS\n");28 return failed;29}30 31// CHECK: PASS32