Test which checks the omp parallel for if directive. Needs at least two threads.
2.0
omp parallel for if
#include
#include
#include "omp_testsuite.h"
int omp_parallel_for_if(FILE * logFile){
int known_sum;
int num_threads;
int sum, sum2;
int i;
int control;
control = 0;
num_threads=0;
sum = 0;
sum2 = 0;
#pragma omp parallel for private(i) if (control==1)
for (i=0; i <= LOOPCOUNT; i++)
{
num_threads = omp_get_num_threads();
sum = sum + i;
} /*end of for*/
known_sum = (LOOPCOUNT * (LOOPCOUNT + 1)) / 2;
fprintf (logFile, "Number of threads determined by omp_get_num_threads: %d\n", num_threads);
return (known_sum == sum && num_threads == 1);
} /* end of check_parallel_for_private */