#include <omp.h>
|
#include <omp.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
#include <string.h>
|
#include <string.h>
|
|
|
int
|
int
|
test1 (void)
|
test1 (void)
|
{
|
{
|
short int buf[64], *p;
|
short int buf[64], *p;
|
int i;
|
int i;
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[10]; &buf[54] > p; p++)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[53]; &buf[9] < p; --p)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for
|
#pragma omp parallel for
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
test2 (void)
|
test2 (void)
|
{
|
{
|
int buf[64], *p;
|
int buf[64], *p;
|
int i;
|
int i;
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (static, 3)
|
#pragma omp parallel for schedule (static, 3)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
test3 (void)
|
test3 (void)
|
{
|
{
|
int buf[64], *p;
|
int buf[64], *p;
|
int i;
|
int i;
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (dynamic, 3)
|
#pragma omp parallel for schedule (dynamic, 3)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
test4 (void)
|
test4 (void)
|
{
|
{
|
int buf[64], *p;
|
int buf[64], *p;
|
int i;
|
int i;
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
for (p = &buf[10]; &buf[54] > p; p++)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
for (p = &buf[3]; &buf[63] >= p; p += 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
for (p = &buf[16]; &buf[51] > p; p = 4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
for (p = &buf[16]; &buf[40] >= p; p = p + 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
for (p = &buf[53]; &buf[9] < p; --p)
|
*p = 5;
|
*p = 5;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
if (buf[i] != 5 * (i >= 10 && i < 54))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
for (p = &buf[63]; &buf[3] <= p; p -= 2)
|
p[-2] = 6;
|
p[-2] = 6;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
if (buf[i] != 6 * ((i & 1) && i <= 61))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
for (p = &buf[48]; &buf[15] < p; p = -4 + p)
|
p[2] = 7;
|
p[2] = 7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
if (buf[i] != 7 * ((i & 3) == 2 && i >= 18 && i < 53))
|
abort ();
|
abort ();
|
memset (buf, '\0', sizeof (buf));
|
memset (buf, '\0', sizeof (buf));
|
#pragma omp parallel for schedule (runtime)
|
#pragma omp parallel for schedule (runtime)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
for (p = &buf[40]; &buf[16] <= p; p = p - 4ULL)
|
p[2] = -7;
|
p[2] = -7;
|
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
if (buf[i] != -7 * ((i & 3) == 2 && i >= 18 && i <= 42))
|
abort ();
|
abort ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|
int
|
int
|
main (void)
|
main (void)
|
{
|
{
|
test1 ();
|
test1 ();
|
test2 ();
|
test2 ();
|
test3 ();
|
test3 ();
|
omp_set_schedule (omp_sched_static, 0);
|
omp_set_schedule (omp_sched_static, 0);
|
test4 ();
|
test4 ();
|
omp_set_schedule (omp_sched_static, 3);
|
omp_set_schedule (omp_sched_static, 3);
|
test4 ();
|
test4 ();
|
omp_set_schedule (omp_sched_dynamic, 5);
|
omp_set_schedule (omp_sched_dynamic, 5);
|
test4 ();
|
test4 ();
|
omp_set_schedule (omp_sched_guided, 2);
|
omp_set_schedule (omp_sched_guided, 2);
|
test4 ();
|
test4 ();
|
return 0;
|
return 0;
|
}
|
}
|
|
|