• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %compile-run-and-check
2 
3 #include <omp.h>
4 #include <stdio.h>
5 
6 const int MaxThreads = 1024;
7 
main(int argc,char * argv[])8 int main(int argc, char *argv[]) {
9   int cancellation = -1, dynamic = -1, nested = -1, maxActiveLevels = -1;
10 
11   #pragma omp target map(cancellation, dynamic, nested, maxActiveLevels)
12   {
13     // libomptarget-nvptx doesn't support cancellation.
14     cancellation = omp_get_cancellation();
15 
16     // No support for dynamic adjustment of the number of threads.
17     omp_set_dynamic(1);
18     dynamic = omp_get_dynamic();
19 
20     // libomptarget-nvptx doesn't support nested parallelism.
21     omp_set_nested(1);
22     nested = omp_get_nested();
23 
24     omp_set_max_active_levels(42);
25     maxActiveLevels = omp_get_max_active_levels();
26   }
27 
28   // CHECK: cancellation = 0
29   printf("cancellation = %d\n", cancellation);
30   // CHECK: dynamic = 0
31   printf("dynamic = %d\n", dynamic);
32   // CHECK: nested = 0
33   printf("nested = %d\n", nested);
34   // CHECK: maxActiveLevels = 1
35   printf("maxActiveLevels = %d\n", maxActiveLevels);
36 
37   return 0;
38 }
39