HOME
| OPENMP API Specification: "Version 5.2 -- GIT rev 95b2e3a44"

1.4.6  OpenMP Memory Consistency

The following rules guarantee an observable completion order for a given pair of memory operations in race-free programs, as seen by all affected threads. If both memory operations are strong flushes, the affected threads are all threads on devices in both of their respective device-sets. If exactly one of the memory operations is a strong flush, the affected threads are all threads on devices in its device-set. Otherwise, the affected threads are all threads.

The flush operation can be specified using the flush directive, and is also implied at various locations in an OpenMP program: see Section 15.8.5 for details.

Since flush operations by themselves cannot prevent data races, explicit flush operations are only useful in combination with non-sequentially consistent atomic directives.

OpenMP programs that:

behave as though operations on shared variables were simply interleaved in an order consistent with the order in which they are performed by each thread. The relaxed consistency model is invisible for such programs, and any explicit flush operations in such programs are redundant.