インテル® Fortran コンパイラー XE 13.1 ユーザー・リファレンス・ガイド

TASKYIELD

OpenMP* Fortran Compiler Directive: Specifies that the current task can be suspended at this point in favor of execution of a different task.

c$OMP TASKYIELD

c

Is one of the following: C (or c), !, or * (see Syntax Rules for Compiler Directives).

Because the TASKYIELD construct is a stand-alone directive, there are some restrictions on its placement within a program:

A TASKYIELD construct binds to the current task region. The binding thread set of the TASKYIELD construct is the current team.

The TASKYIELD construct includes an explicit task scheduling point in the current task region.

The following example shows use of the TASKYIELD directive. It is non-conforming, because the FLUSH, BARRIER, TASKWAIT, and TASKYIELD directives are stand-alone directives and cannot be the action statement of an IF statement or a labeled branch target.

SUBROUTINE NONCONFORMING_STANDALONE()
   INTEGER A
   A = 1
   ! the FLUSH directive must not be the action statement in an IF statement
   !
   IF (A .NE. 0) !$OMP FLUSH(A)
 
   ! the BARRIER directive must not be the action statement in an IF statement
   !
   IF (A .NE. 0) !$OMP BARRIER
 
   ! the TASKWAIT directive must not be the action statement in an IF statement
   !
   IF (A .NE. 0) !$OMP TASKWAIT
 
   ! the TASKYIELD directive must not be the action statement in an IF statement
   !
   IF (A .NE. 0) !$OMP TASKYIELD
 
   GOTO 100
 
   ! the FLUSH directive must not be a labeled branch target statement
   !
   100 !$OMP FLUSH(A)
   GOTO 200
 
   ! the BARRIER directive must not be a labeled branch target statement
   !
   200 !$OMP BARRIER
   GOTO 300
 
   ! the TASKWAIT directive must not be a labeled branch target statement
   !
   300 !$OMP TASKWAIT
   GOTO 400
 
   ! the TASKYIELD directive must not be a labeled branch target statement
   !
   400 !$OMP TASKYIELD
END SUBROUTINE

The following version of the above example is conforming because the FLUSH, BARRIER, TASKWAIT, and TASKYIELD directives are enclosed in a compound statement.

SUBROUTINE CONFORMING_STANDALONE ()
   INTEGER N
   N = 1
   IF (N .NE. 0) THEN
       !$OMP FLUSH(N)
   ENDIF
   IF (N .NE. 0) THEN
       !$OMP BARRIER
   ENDIF
   IF (N .NE. 0) THEN
       !$OMP TASKWAIT
   ENDIF
   IF (N .NE. 0) THEN
       !$OMP TASKYIELD
   ENDIF
   GOTO 100
   100 CONTINUE
   !$OMP FLUSH(N)
   GOTO 200
   200 CONTINUE
   !$OMP BARRIER
   GOTO 300
   300 CONTINUE
   !$OMP TASKWAIT
   GOTO 400
   400 CONTINUE
   !$OMP TASKYIELD
END SUBROUTINE

関連情報


このヘルプトピックについてのフィードバックを送信