An official website of the United States government

Official websites use .gov
A .gov website belongs to an official government organization in the United States.

Secure .gov websites use HTTPS
A lock ( ) or https:// means you’ve safely connected to the .gov website. Share sensitive information only on official, secure websites.


Home

OpenMP Directives: Data Scope Attribute Clauses: DEFAULT Clause

Purpose:

The DEFAULT clause allows the user to specify a default scope for all variables in the lexical extent of any parallel region.

Format:

Fortran

DEFAULT (PRIVATE | FIRSTPRIVATE | SHARED | NONE)

C/C++

default (shared | none)

Notes:

  • Specific variables can be exempted from the default using the PRIVATE, SHARED, FIRSTPRIVATE, LASTPRIVATE, and REDUCTION clauses.

  • The C/C++ OpenMP specification does not include private or firstprivate as a possible default. However, actual implementations may provide this option.

  • Using NONE as a default requires that the programmer explicitly scope all variables.

Restrictions:

Only one DEFAULT clause can be specified on a PARALLEL directive.