There are two types of synchronization, implicit and explicit. Implicit synchronization points exist at the beginning and end of PARALLEL constructs, and at the end of all other control constructs (i.e. DO, SINGLE, MASTER and ORDERED). In the case of DO and SINGLE, the implicit synchronization can be removed with the NOWAIT clause.
Explicit synchronization is specified by the user to manage order or data dependencies. Synchronization is a form of interprocess communication and as such can greatly impact program performance. In general, best performance is achieved by minimizing the synchronization requirements (explicit and implicit) of a program. For this reason OpenMP provides a rich set of synchronization features so developers can best tune the synchronization in an application. We saw an example using the ATOMIC directive. This feature that allows the compiler to take advantage of available hardware for implementing atomic updates to a variable. OpenMP also provides a FLUSH directive for creating more complex synchronization constructs such as point-to-point synchronization. The implicit barriers in the energy spectrum example could be eliminated and replaced by point-to-point synchronization for the ultimate in performance.
All the OpenMP synchronization directives may be orphaned. As discussed earlier, this is critically important for implementing coarse grained parallel algorithms.