brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · a8b2cc8 Raw
40 lines · c
1// RUN: %libomptarget-compile-generic2// RUN: %libomptarget-run-generic 2>&1 \3// RUN: | %fcheck-generic4 5// END.6 7#include <omp.h>8#include <stdio.h>9 10int main() {11  int arr[100];12 13#pragma omp target data map(alloc : arr[50 : 2]) // partially mapped14  {15    // CHECK: arr[50] must present: 116    fprintf(stderr, "arr[50] must present: %d\n",17            omp_target_is_present(&arr[50], omp_get_default_device()));18 19    // CHECK: arr[0] should not present: 020    fprintf(stderr, "arr[0] should not present: %d\n",21            omp_target_is_present(&arr[0], omp_get_default_device()));22 23    // CHECK: arr[49] should not present: 024    fprintf(stderr, "arr[49] should not present: %d\n",25            omp_target_is_present(&arr[49], omp_get_default_device()));26 27#pragma omp target // would implicitly map with full size but already present28    {29      arr[50] = 5;30      arr[51] = 6;31    } // must treat as present (dec ref count) even though full size not present32  }   // wouldn't delete if previous ref count dec didn't happen33 34  // CHECK: arr[50] still present: 035  fprintf(stderr, "arr[50] still present: %d\n",36          omp_target_is_present(&arr[50], omp_get_default_device()));37 38  return 0;39}40