testsuite/libgomp.c/collapse-1.c

Go to the documentation of this file.
00001 /* { dg-do run } */
00002 
00003 #include <string.h>
00004 #include <stdlib.h>
00005 
00006 int
00007 main (void)
00008 {
00009   int i, j, k, l = 0;
00010   int a[3][3][3];
00011 
00012   memset (a, '\0', sizeof (a));
00013   #pragma omp parallel for collapse(4 - 1) schedule(static, 4)
00014     for (i = 0; i < 2; i++)
00015       for (j = 0; j < 2; j++)
00016     for (k = 0; k < 2; k++)
00017       a[i][j][k] = i + j * 4 + k * 16;
00018   #pragma omp parallel
00019     {
00020       #pragma omp for collapse(2) reduction(|:l) private(k)
00021     for (i = 0; i < 2; i++)
00022       for (j = 0; j < 2; j++)
00023         for (k = 0; k < 2; k++)
00024           if (a[i][j][k] != i + j * 4 + k * 16)
00025         l = 1;
00026     }
00027   if (l)
00028     abort ();
00029   return 0;
00030 }

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