They are not equivalent.
foo()will execute two fprintf(parts) sequentially. bar()can execute them in parallel.
For an exhaustive reference, you can refer to the IBM compiler documentation .
Essentially, in the case, a foo()single worker thread processes first part, then terminates, and resynchronizes with the main thread ( barrierby the way, implied at the end of singleconstruct.) Then, a new worker thread processes second part, terminates, and resynchronizes with the main thread.
bar() ( first part - .) .
#pragma omp parallel
omp . , . . .
, . .
.
#pragma omp single
omp , .
nowait.
#pragma omp, #pragma omp
omp , .
omp omp. omp. omp , omp.
omp , omp . omp, nowait .