Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

DEFAULT Clause

Parallel Directive Clause: Lets you specify a scope for all variables in the lexical extent of a parallel region.

Syntax

DEFAULT (PRIVATE | FIRSTPRIVATE | SHARED | NONE )

The specifications have the following effects:

  • PRIVATE - Makes all named objects in the lexical extent of the parallel region, including common block variables but excluding THREADPRIVATE variables, private to a thread as if you explicitly listed each variable in a PRIVATE clause.

  • FIRSTPRIVATE - Makes all variables in the construct that have implicitly determined data-sharing attributes firstprivate as if you explicitly listed each variable in a FIRSTPRIVATE clause.

  • SHARED - Makes all named objects in the lexical extent of the parallel region shared among the threads in a team, as if you explicitly listed each variable in a SHARED clause. If you do not specify a DEFAULT clause, this is the default.

  • NONE - Specifies that there is no implicit default as to whether variables are PRIVATE or SHARED. In this case, you must specify the PRIVATE, SHARED, FIRSTPRIVATE, LASTPRIVATE, or REDUCTION property of each variable you use in the lexical extent of the parallel region.

You can specify only one DEFAULT clause in a PARALLEL directive. You can exclude variables from a defined default by using the PRIVATE, SHARED, FIRSTPRIVATE, LASTPRIVATE, or REDUCTION clauses.

Variables in THREADPRIVATE common blocks are not affected by this clause.