00001
00002
00003 #include <stdlib.h>
00004 #include <omp.h>
00005
00006 int
00007 main (void)
00008 {
00009 int i, j, k, l = 0, f = 0;
00010 int m1 = 4, m2 = -5, m3 = 17;
00011
00012 #pragma omp parallel for num_threads (8) collapse(3) \
00013 schedule(static, 9) reduction(+:l) \
00014 firstprivate(f)
00015 for (i = -2; i < m1; i++)
00016 for (j = m2; j < -2; j++)
00017 {
00018 for (k = 13; k < m3; k++)
00019 {
00020 if (omp_get_num_threads () == 8
00021 && ((i + 2) * 12 + (j + 5) * 4 + (k - 13)
00022 != (omp_get_thread_num () * 9
00023 + f++)))
00024 l++;
00025 }
00026 }
00027 if (l)
00028 abort ();
00029 return 0;
00030 }