teams-1.c 729 B

12345678910111213141516171819202122232425262728293031
  1. /* { dg-additional-options "-Wno-deprecated-declarations" } */
  2. #include <omp.h>
  3. #include <stdlib.h>
  4. int
  5. main ()
  6. {
  7. omp_set_dynamic (0);
  8. omp_set_nested (1);
  9. #pragma omp teams thread_limit (2)
  10. {
  11. #pragma omp distribute dist_schedule(static,1)
  12. for (int i = 0; i < 1; ++i)
  13. if (omp_in_parallel ()
  14. || omp_get_level () != 0
  15. || omp_get_ancestor_thread_num (0) != 0
  16. || omp_get_ancestor_thread_num (1) != -1)
  17. abort ();
  18. #pragma omp parallel num_threads (2)
  19. {
  20. if (!omp_in_parallel ()
  21. || omp_get_level () != 1
  22. || omp_get_ancestor_thread_num (0) != 0
  23. || omp_get_ancestor_thread_num (1) != omp_get_thread_num ()
  24. || omp_get_ancestor_thread_num (2) != -1)
  25. abort ();
  26. }
  27. }
  28. return 0;
  29. }