Work Sharing Constructs
Work sharing constructs is automatic way to distribute computation to parallel threads
[FIRSTPRIVATE(list)] [LASTPRIVATE(list)]
[ORDERED] [SCHEDULE(kind[,chunk])]
[REDUCTION({op|intrinsic}:list)]
[C$OMP END DO [NOWAIT]] {#pragma omp for}
C$OMP SECTIONS [PRIVATE(list)]
[FIRSTPRIVATE(list)] [LASTPRIVATE(list)]
[REDUCTION({op|intrinsic}:list)]
C$OMP END SECTIONS [NOWAIT] {#pragma omp sections}
C$OMP SINGLE [PRIVATE(list)] [FIRSTPRIVATE(list)]
C$OMP END SINGLE [NOWAIT]
Each section’s block of code will be
run in a separate thread in parallel
Do loop iterations will be subdivided
according to SCHEDULE and each
chunk executed in a separate thread
First thread that reaches SINGLE will
execute block, others will skip it and
wait for synchronization at END SINGLE