icv-1.c 617 B

123456789101112131415161718192021222324252627282930313233
  1. #include <omp.h>
  2. #include <stdlib.h>
  3. int
  4. main (void)
  5. {
  6. int err = 0;
  7. omp_set_num_threads (4);
  8. if (omp_get_max_threads () != 4)
  9. abort ();
  10. #pragma omp parallel reduction(|: err) num_threads(1)
  11. {
  12. if (omp_get_max_threads () != 4)
  13. err |= 1;
  14. omp_set_num_threads (6);
  15. #pragma omp task if(0) shared(err)
  16. {
  17. if (omp_get_max_threads () != 6)
  18. err |= 2;
  19. omp_set_num_threads (5);
  20. if (omp_get_max_threads () != 5)
  21. err |= 4;
  22. }
  23. if (omp_get_max_threads () != 6)
  24. err |= 8;
  25. }
  26. if (err)
  27. abort ();
  28. if (omp_get_max_threads () != 4)
  29. abort ();
  30. return 0;
  31. }