testsuite/libgomp.c/pr42942.c

Go to the documentation of this file.
00001 /* PR libgomp/42942 */
00002 /* { dg-do run } */
00003 
00004 #include <omp.h>
00005 #include <stdlib.h>
00006 
00007 int
00008 main (void)
00009 {
00010   int e = 0;
00011   omp_set_dynamic (0);
00012   omp_set_nested (1);
00013   omp_set_max_active_levels (1);
00014   if (omp_get_max_active_levels () != 1)
00015     abort ();
00016 #pragma omp parallel num_threads(2) reduction(|:e)
00017   if (!omp_in_parallel ()
00018       || omp_get_num_threads () != 2)
00019     e = 1;
00020   else
00021 #pragma omp parallel num_threads(2) reduction(|:e)
00022     if (!omp_in_parallel ()
00023     || omp_get_num_threads () != 1)
00024       e = 1;
00025   if (e)
00026     abort ();
00027   omp_set_max_active_levels (0);
00028   if (omp_get_max_active_levels () != 0)
00029     abort ();
00030 #pragma omp parallel num_threads(2) reduction(|:e)
00031   if (omp_in_parallel ()
00032       || omp_get_num_threads () != 1)
00033     e = 1;
00034   else
00035 #pragma omp parallel num_threads(2) reduction(|:e)
00036     if (omp_in_parallel ()
00037     || omp_get_num_threads () != 1)
00038       e = 1;
00039   if (e)
00040     abort ();
00041   omp_set_max_active_levels (2);
00042   if (omp_get_max_active_levels () != 2)
00043     abort ();
00044 #pragma omp parallel num_threads(2) reduction(|:e)
00045   if (!omp_in_parallel ()
00046       || omp_get_num_threads () != 2)
00047     e = 1;
00048   else
00049 #pragma omp parallel num_threads(2) reduction(|:e)
00050     if (!omp_in_parallel ()
00051     || omp_get_num_threads () != 2)
00052       e = 1;
00053     else
00054 #pragma omp parallel num_threads(2) reduction(|:e)
00055       if (!omp_in_parallel ()
00056       || omp_get_num_threads () != 1)
00057     e = 1;
00058   if (e)
00059     abort ();
00060   return 0;
00061 }

Generated on Fri Apr 5 05:38:10 2013 for Libgomp by  doxygen 1.4.7