nested-2.c 589 B

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