summaryrefslogtreecommitdiff
path: root/offload/test/mapping/present/unified_shared_memory.c
blob: ab6e3bd0e5fa70bd94fe7bceaa6891211190b4bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// RUN: %libomptarget-compile-generic
// RUN: %libomptarget-run-generic 2>&1 \
// RUN: | %fcheck-generic

// REQUIRES: unified_shared_memory

#include <stdio.h>

// The runtime considers unified shared memory to be always present.
#pragma omp requires unified_shared_memory

int main() {
  int i;

  // CHECK-NOT: omptarget
#pragma omp target data map(alloc : i)
#pragma omp target map(present, alloc : i)
  ;

  // CHECK: i is present
  fprintf(stderr, "i is present\n");

  // CHECK-NOT: omptarget
#pragma omp target map(present, alloc : i)
  ;

  // CHECK: is present
  fprintf(stderr, "i is present\n");

  return 0;
}