brintos

brintos / llvm-project-archived public Read only

0
0
Text · 426 B · f849cb4 Raw
21 lines · c
1// RUN: %libomptarget-compile-run-and-check-generic2 3#include <omp.h>4#include <stdio.h>5 6int main(void) {7  int isHost = -1;8 9#pragma omp target map(from : isHost)10  { isHost = omp_is_initial_device(); }11 12  if (isHost < 0) {13    printf("Runtime error, isHost=%d\n", isHost);14  }15 16  // CHECK: Target region executed on the device17  printf("Target region executed on the %s\n", isHost ? "host" : "device");18 19  return isHost;20}21