I would like to tell you about an error that a person, not familiar with OpenMP technology, can easily make. The error is related to a wrong supposition about how atomic directive works. The atomic directive works faster than critical sections because some atomic operations can be directly replaced with processor commands. That is why it is convenient to use when calculating various expressions. But you should keep in mind that atomic in no way influences the calls of the functions used in the expression.
Since multi-core systems are spreading fast, the problem of parallel programming becomes more and more urgent. However, even the majority of experienced developers are new to this sphere. The existing compilers and code analyzers, allow finding of some bugs which appear during parallel code development. However, many errors are not diagnosed. This article contains descriptions of a number of errors which lead to incorrect behavior of parallel programs created with OpenMP.