HP aC++/HP C A.06.28 Programmer's Guide Integrity servers (769150-001, March 2014)
The atomic directive ensures that a specific memory location is updated atomically, rather than
exposing it to the possibility of multiple, simultaneous writing threads.
OMP BARRIER Pragma
#pragma omp barrier
The barrier pragma synchronizes all the threads in a team. When encountered, each thread
waits until all the threads in the team have reached that point.
The smallest statement to contain a barrier must be a block or a compound statement. barrier
is valid only inside a parallel region and outside the scope of for, section, sections,
critical, ordered, and master.
OMP CRITICAL Pragma
#pragma omp critical [(name)]
structured-block
The critical pragma identifies a construct that restricts the execution of the associated structured
block to one thread at a time.
The name parameter is optional. All unnamed critical sections map to the same name.
OMP FOR Pragma
#pragma omp for [clause1,clause2, ...]
for-loop
where [clause1, clause2, ...] indicates that the clauses are optional. There can be zero or
more clauses.
clause may be one of the following:
• private(list)
• firstprivate(list)
• lastprivate(list)
• ordered
• schedule(kind[,chunksize])
• nowait
See “OpenMP Clauses” (page 114) for more information.
OMP FLUSH Pragma
#pragma omp flush [(list)]
where (list) names the variables that will be synchronized.
The flush pragma, whether explicit or implied, specifies a cross-thread sequence point at which
the implementation is required to ensure that all the threads in a team have a consistent view of
certain objects in the memory. A flush directive without a list is implied for the following directives:
• barrier
• an entry to and exit from critical
• at entry to and exit from ordered
• at entry to and exit from parallel
• at entry to and exit from parallel for
• at entry to and exit from parallel sections
Other Pragmas 111