10.07.2015 Views

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

PGI Fortran Reference manual - The Portland Group

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

OpenMP Directives for <strong>Fortran</strong>Usage<strong>The</strong> TASK / END TASK directive pair defines an explicit task.When a thread encounters a task construct, a task is generated from the code for the associatedstructured block. <strong>The</strong> data environment of the task is created according to the data-sharingattribute clauses on the task construct and any defaults that apply. <strong>The</strong> encountering thread mayimmediately execute the task, or delay its execution. If the task execution is delayed, then anythread in the team may be assigned the task. Completion of the task can be guaranteed using tasksynchronization constructs.A task construct may be nested inside an outer task, but the task region of the inner task is not apart of the task region of the outer task.When an if clause is present on a task construct and the if clause expression evaluates to false, theencountering thread must suspend the current task region and begin execution of the generatedtask immediately, and the suspended task region may not be resumed until the generated task iscompleted. <strong>The</strong> task still behaves as a distinct task region with respect to data environment, lockownership, and synchronization constructs.Use of a variable in an if clause expression of a task construct causes an implicit reference to the variablein all enclosing constructs.A thread that encounters a task scheduling point within the task region may temporarily suspendthe task region. By default, a task is tied and its suspended task region can only be resumed by thethread that started its execution. If the untied clause is present on a task construct, any thread inthe team can resume the task region after a suspension.<strong>The</strong> task construct includes a task scheduling point in the task region of its generating task,immediately following the generation of the explicit task. Each explicit task region includes atask scheduling point at its point of completion. An implementation may add task schedulingpoints anywhere in untied task regions.When storage is shared by an explicit task region, it is the programmer's responsibility to ensure, byadding proper synchronization, that the storage does not reach the end of its lifetime before the explicit taskregion completes its execution.Restrictions<strong>The</strong> following restrictions apply to the TASK directive:‣ A program that branches into or out of a task region is non-conforming.‣ A program must not depend on any ordering of the evaluations of the clauses of the taskdirective, or on any side effects of the evaluations of the clauses.‣ At most one if clause can appear on the directive.<strong>PGI</strong> <strong>Fortran</strong> <strong>Reference</strong> Guide 177

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!