#pragma omp flush

Description

The omp flush directive identifies a point at which the compiler ensures that all threads in a parallel region have the same view of specified objects in memory.

Syntax

#pragma omp flush [ (list) ]

where list is a comma-separated list of variables that will be synchronized.

Notes

If list includes a pointer, the pointer is flushed, not the object being referred to by the pointer. If list is not specified, all shared objects are synchronized except those inaccessible with automatic storage duration.

An implied flush directive appears in conjuction with the following directives:

The omp flush directive must appear within a block or compound statement. For example:

if (x!=0) {
   #pragma omp flush    /* valid usage    */
}
 
if (x!=0)
   #pragma omp flush    /* invalid usage  */

Related References

Pragmas to Control Parallel Processing
#pragma omp barrier
#pragma omp critical
#pragma omp for
#pragma omp parallel
#pragma omp parallel for
#pragma omp parallel sections
#pragma omp section, #pragma omp sections
#pragma omp single IBM Copyright 2003