1 // RUN: %libomptarget-compile-generic && env LIBOMPTARGET_DEBUG=1 %libomptarget-run-generic 2>&1 | %fcheck-generic -allow-empty -check-prefix=DEBUG 2 // REQUIRES: libomptarget-debug 3 4 /* 5 Test for looptripcount being popped from runtime stack. 6 */ 7 #include <stdio.h> 8 #include <omp.h> 9 int main() 10 { 11 int N = 128; 12 int NN = 1024; 13 int num_teams[NN]; 14 int num_threads[NN]; 15 16 printf("#pragma omp target teams distribute parallel for thread_limit(4)\n"); 17 #pragma omp target teams distribute parallel for thread_limit(4) 18 for (int j = 0; j< N; j++) { 19 num_threads[j] = omp_get_num_threads(); 20 num_teams[j] = omp_get_num_teams(); 21 } 22 printf("num_threads %d num_teams %d\n", num_threads[0], num_teams[0]); 23 // DEBUG: loop trip count is 128 24 printf("#pragma omp target teams distribute parallel for\n"); 25 #pragma omp target teams distribute parallel for 26 for (int j = 0; j< N; j++) { 27 num_threads[j] = omp_get_num_threads(); 28 num_teams[j] = omp_get_num_teams(); 29 } 30 printf("num_threads %d num_teams %d\n", num_threads[0], num_teams[0]); 31 // DEBUG: loop trip count is 128 32 return 0; 33 } 34