#pragma omp cancellation point

Purpose

The omp cancellation point introduces a user-defined cancellation point, at which the encountering task checks if cancellation of the innermost enclosing region of the specified type has been activated.

Syntax

Read syntax diagramSkip visual syntax diagram # pragma omp cancellation point type_clause
where type_clause is:
Read syntax diagramSkip visual syntax diagram parallelsectionsfortaskgroup

Usage

The omp cancellation point directive is a stand-alone directive. It takes effect only when the OMP_CANCELLATION environment variable is set to true. The binding thread set of the cancellation point region is the current team, and the binding region is the innermost enclosing region of the type that is specified in type_clause.

The compiler can add implicit cancellation points in your program. However, you might improve the performance by explicitly setting the omp cancellation point directive.

Note: The omp cancellation point directive does not guarantee the synchronization between threads or tasks.

Rules

Consider the following location restrictions of the omp cancellation point directive:
  • The omp cancellation point taskgroup directive must be nested inside a omp task directive, and the cancellation point region must be nested inside a taskgroup region.
  • The omp cancellation point sections directive must be nested inside a omp section or omp sections directive.
  • The omp cancellation point parallel directive must be nested inside a omp parallel directive.
  • The omp cancellation point for directive must be nested inside a omp for directive.