The omp single directive identifies a section of code that must be run by a single available thread.
.-+---+------. | '-,-' | V | >>-#--pragma--omp single----+--------+-+----------------------->< '-clause-'
where clause is any of the following:
private (list) | Declares the scope of the data variables in list to be private to each thread. Data variables in list are separated by commas.
A variable in the private clause must not also appear in a copyprivate clause for the same omp single directive. |
copyprivate (list) | Broadcasts the values of variables specified in list from one member of the team to other members. This occurs after
the execution of the structured block associated with the omp single directive, and before any of the threads leave the barrier
at the end of the construct. For all other threads in the team, each variable
in the list becomes defined with the value of the
corresponding variable in the thread that executed the structured block. Data
variables in list are separated by commas. Usage restrictions
for this clause are:
|
firstprivate (list) | Declares the scope of the data variables in list to be private to each thread. Each new private object is initialized
as if there was an implied declaration within the statement block. Data variables
in list are separated by commas.
A variable in the firstprivate clause must not also appear in a copyprivate clause for the same omp single directive. |
nowait | Use this clause to avoid the implied barrier at the end of the single directive. Only one nowait clause can appear on a given single directive. The nowait clause must not be used together with the copyprivate clause. |
An implied barrier exists at the end of a parallelized statement block unless the nowait clause is specified.