Search code examples
multithreadinglockingopenmpmemory-fences

OpenMP flush and consistency of all threads


When some thread performs omp_set_lock, an implicit flush is performed.

But does that mean that after the flush by this particular thread, all other threads will update their private view to value from shared memory even though they don't perform flush themselves. Or will they still read values from private view?


Solution

  • No: in order to have a consistent view, all threads must perform a flush. This is explained in Section 1.4.3 of the spec.