Test which checks that omp_in_parallel returns false when called from a serial region and true when called within a parallel region.
2.0
omp_in_parallel
/*
* Checks that false is returned when called from serial region
* and true is returned when called within parallel region.
*/
#include
#include "omp_testsuite.h"
int omp_in_parallel(FILE * logFile){
int serial;
int isparallel;
serial = 1;
isparallel = 0;
serial = omp_in_parallel ();
#pragma omp parallel
{
#pragma omp single
{
isparallel = omp_in_parallel ();
}
}
#pragma omp parallel
{
#pragma omp single
{
}
}
return (!(serial) && isparallel);
}