Shared and private variables in a parallel environment

Some OpenMP clauses let you specify visibility context for selected data variables. A brief summary of data scope attribute clauses are listed below:
Data scope attribute clause Description
private The private clause declares the variables in the list to be private to each thread in a team.
firstprivate The firstprivate clause provides a superset of the functionality provided by the private clause. The private variable is initialized by the original value of the variable when the parallel construct is encountered.
lastprivate The lastprivate clause provides a superset of the functionality provided by the private clause. The private variable is updated after the end of the parallel construct.
shared The shared clause declares the variables in the list to be shared among all the threads in a team. All threads within a team access the same storage area for shared variables.
reduction The reduction clause performs a reduction on the scalar variables that appear in the list, with a specified operator.
default The default clause allows the user to affect the data-sharing attribute of the variables appeared in the parallel construct.

For more information, see the OpenMP directive descriptions in Pragma directives for parallel processing in the XL C/C++ Compiler Reference. You can also refer to the OpenMP Application Program Interface Language Specification, which is available at http://www.openmp.org.



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