| 1 |
#ifdef __cplusplus |
| 2 |
extern "C" { |
| 3 |
#endif |
| 4 |
|
| 5 |
int omp_get_num_teams (void); |
| 6 |
int bar (void); |
| 7 |
|
| 8 |
#ifdef __cplusplus |
| 9 |
} |
| 10 |
#endif |
| 11 |
|
| 12 |
/* { dg-do compile } */ |
| 13 |
|
| 14 |
#pragma omp requires reverse_offload |
| 15 |
|
| 16 |
void |
| 17 |
foo (void) |
| 18 |
{ |
| 19 |
/* Ensure that no calls to OpenMP API runtime routines are allowed inside the |
| 20 |
corresponding target region. */ |
| 21 |
|
| 22 |
int a; |
| 23 |
|
| 24 |
#pragma omp target device (ancestor: 1) |
| 25 |
{ |
| 26 |
a = bar (); /* OK */ |
| 27 |
a = omp_get_num_teams (); /* { dg-error "OpenMP runtime API call '\[^\n\r]*omp_get_num_teams\[^\n\r]*' in a region with 'device\\(ancestor\\)' clause" } */ |
| 28 |
} |
| 29 |
|
| 30 |
#pragma omp target device (device_num: 1) |
| 31 |
{ |
| 32 |
a = omp_get_num_teams (); |
| 33 |
} |
| 34 |
|
| 35 |
#pragma omp target device (1) |
| 36 |
{ |
| 37 |
a = omp_get_num_teams (); |
| 38 |
} |
| 39 |
} |