2021-04-27 15:50:53 +02:00
|
|
|
// RUN: %libomptarget-compile-run-and-check-generic
|
2019-01-03 21:14:19 +00:00
|
|
|
|
|
|
|
#include <omp.h>
|
2022-10-19 08:26:35 -05:00
|
|
|
#include <stdio.h>
|
2019-01-03 21:14:19 +00:00
|
|
|
|
2022-10-19 08:26:35 -05:00
|
|
|
int test_omp_get_num_devices() {
|
2019-01-03 21:14:19 +00:00
|
|
|
/* checks that omp_get_num_devices() > 0 */
|
|
|
|
int num_devices = omp_get_num_devices();
|
|
|
|
printf("num_devices = %d\n", num_devices);
|
|
|
|
|
2022-10-19 08:26:35 -05:00
|
|
|
#pragma omp target
|
2019-01-03 21:14:19 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
return (num_devices > 0);
|
|
|
|
}
|
|
|
|
|
2022-10-19 08:26:35 -05:00
|
|
|
int main() {
|
2019-01-03 21:14:19 +00:00
|
|
|
int i;
|
2022-10-19 08:26:35 -05:00
|
|
|
int failed = 0;
|
2019-01-03 21:14:19 +00:00
|
|
|
|
|
|
|
if (!test_omp_get_num_devices()) {
|
|
|
|
failed++;
|
|
|
|
}
|
|
|
|
if (failed)
|
|
|
|
printf("FAIL\n");
|
|
|
|
else
|
|
|
|
printf("PASS\n");
|
|
|
|
return failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
// CHECK: PASS
|