/* * @@name: metadirective.4 * @@type: C * @@operation: run * @@expect: success * @@version: omp_5.2 */ #define N 100 #include #include #include #include void foo(int *a, int n, bool use_gpu) { int b=0; // use b to detect if run on gpu #pragma omp metadirective \ when( user={condition(use_gpu)}: \ target teams distribute parallel for \ private(b) map(from:a[0:n]) ) \ otherwise( \ parallel for ) for (int i=0; i