#pragma omp flush

Purpose

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

Read syntax diagramSkip visual syntax diagram
                         .-+---+----.   
                         | '-,-'    |   
                         V          |   
>>-#--pragma--omp flush----+------+-+--------------------------><
                           '-list-'     

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

Usage

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 conjunction with the following directives:

  • omp barrier
  • Entry to and exit from omp critical.
  • Exit from omp parallel.
  • Exit from omp for.
  • Exit from omp sections.
  • Exit from omp single.

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  */


Voice your opinion on getting help information Ask IBM compiler experts a technical question in the IBM XL compilers forum Reach out to us