For my understanding,
I can use single directive do the same work as using sections just add nowait flags
The following code has no different to me compare to section directive:
void main(){
#pragma omp parallel
{
int tid = omp_get_thread_num();
#pragma omp single nowait
{
printf("Thread %d in #1 single construct.\n", tid);
}
#pragma omp single nowait
{
printf("Thread %d in #2 single construct.\n", tid);
}
#pragma omp single nowait
{
printf("Thread %d in #3 single construct.\n", tid);
}
}
}
Can any one give me some examples using sections and single directives in different scenarios?