2021-04-27 15:50:53 +02:00
|
|
|
// RUN: %libomptarget-compilexx-run-and-check-generic
|
2017-01-25 21:27:24 +00:00
|
|
|
|
|
|
|
|
#include <omp.h>
|
2022-10-19 08:26:35 -05:00
|
|
|
#include <stdio.h>
|
2017-01-25 21:27:24 +00:00
|
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
|
int isHost = 0;
|
|
|
|
|
|
2022-10-19 08:26:35 -05:00
|
|
|
#pragma omp target map(from : isHost)
|
2017-01-25 21:27:24 +00:00
|
|
|
{ isHost = omp_is_initial_device(); }
|
|
|
|
|
|
|
|
|
|
if (isHost < 0) {
|
|
|
|
|
printf("Runtime error, isHost=%d\n", isHost);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// CHECK: Target region executed on the device
|
|
|
|
|
printf("Target region executed on the %s\n", isHost ? "host" : "device");
|
|
|
|
|
|
|
|
|
|
return isHost;
|
|
|
|
|
}
|