I started learning OpenMP and discovered the #pragma omp atomic
directive.
I have basic understanding of C++11's atomics and know that you can pass a memory_order
parameter to atomics's method.
Correct me if I'm wrong, but I think this allows to use atomics as a synchronization point if using memory_order_seq_cst
for example.
Some less restrictive memory order, like memory_order_relaxed
just make sure that the operations on the atomic are synchronized and visible to others. It doesnt nothing about other memory updates.
I would like to know what memory order is used by the OpenMP's atomic directive. Will it only synchronize access to the atomic, or will it act as a memory synchronization's point?
My guess would be that it would be more like memory_order_relaxed
, because critical
's are here to provide a full synchronization.
I welcome any good explanation / informations. Thanks.