Retro68/gcc/libgomp/testsuite/libgomp.c/ordered-3.c
Wolfgang Thaller aaf905ce07 add gcc 4.70
2012-03-28 01:13:14 +02:00

83 lines
1.4 KiB
C

#include <stdlib.h>
int cnt;
void
check (int x)
{
if (cnt++ != x)
abort ();
}
int
main (void)
{
int j;
cnt = 0;
#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (0)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (static, 1) num_threads (4) if (1)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (0)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (runtime) num_threads (4) if (1)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (0)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (dynamic) num_threads (4) if (1)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (guided) num_threads (4) if (0)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
cnt = 0;
#pragma omp parallel for ordered schedule (guided) num_threads (4) if (1)
for (j = 0; j < 1000; j++)
{
#pragma omp ordered
check (j);
}
return 0;
}