00001 #include <omp.h> 00002 #include <stdlib.h> 00003 00004 int 00005 main (void) 00006 { 00007 int err = 0; 00008 00009 omp_set_num_threads (4); 00010 if (omp_get_max_threads () != 4) 00011 abort (); 00012 #pragma omp parallel reduction(|: err) num_threads(1) 00013 { 00014 if (omp_get_max_threads () != 4) 00015 err |= 1; 00016 omp_set_num_threads (6); 00017 #pragma omp task if(0) shared(err) 00018 { 00019 if (omp_get_max_threads () != 6) 00020 err |= 2; 00021 omp_set_num_threads (5); 00022 if (omp_get_max_threads () != 5) 00023 err |= 4; 00024 } 00025 if (omp_get_max_threads () != 6) 00026 err |= 8; 00027 } 00028 if (err) 00029 abort (); 00030 if (omp_get_max_threads () != 4) 00031 abort (); 00032 return 0; 00033 }