(root)/
gcc-13.2.0/
libgomp/
testsuite/
libgomp.c-c++-common/
requires-5.c
       1  /* { dg-additional-options "-foffload-options=nvptx-none=-misa=sm_35" { target { offload_target_nvptx } } } */
       2  /* { dg-additional-sources requires-5-aux.c } */
       3  
       4  /* Depending on offload device capabilities, it may print something like the
       5     following (only) if GOMP_DEBUG=1:
       6     "devices present but 'omp requires unified_address, unified_shared_memory, reverse_offload' cannot be fulfilled"
       7     and in that case does host-fallback execution.
       8  
       9     As no offload devices support USM at present, we may verify host-fallback
      10     execution by absence of separate memory spaces.  */
      11  
      12  #pragma omp requires unified_shared_memory, unified_address, reverse_offload
      13  
      14  int a[10] = { 0 };
      15  extern void foo (void);
      16  
      17  int
      18  main (void)
      19  {
      20    #pragma omp target map(to: a)
      21    for (int i = 0; i < 10; i++)
      22      a[i] = i;
      23  
      24    for (int i = 0; i < 10; i++)
      25      if (a[i] != i)
      26        __builtin_abort ();
      27  
      28    foo ();
      29    return 0;
      30  }