Test which checks the omp single copyprivate directive.
2.0
omp single copyprivate
omp parllel,omp critical
#include "omp_testsuite.h"
int j;
#pragma omp threadprivate(j)
int omp_single_copyprivate(FILE * logFile)
{
int result;
int nr_iterations;
result = 0;
nr_iterations = 0;
#pragma omp parallel
{
int i;
for (i = 0; i < LOOPCOUNT; i++)
{
/*
int thread;
thread = omp_get_thread_num ();
*/
#pragma omp single copyprivate(j)
{
nr_iterations++;
j = i;
/*printf ("thread %d assigns, j = %d, i = %d\n", thread, j, i);*/
}
/* #pragma omp barrier*/
#pragma omp critical
{
/*printf ("thread = %d, j = %d, i = %d\n", thread, j, i);*/
result = result + j - i;
}
#pragma omp barrier
} /* end of for */
} /* end of parallel */
return ((result == 0) && (nr_iterations == LOOPCOUNT));
}