LLVM OpenMP 20.0.0git
Functions
kmp_cancel.cpp File Reference
#include "kmp.h"
#include "kmp_i18n.h"
#include "kmp_io.h"
#include "kmp_str.h"

Go to the source code of this file.

Functions

kmp_int32 __kmpc_cancel (ident_t *loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind)
 
kmp_int32 __kmpc_cancellationpoint (ident_t *loc_ref, kmp_int32 gtid, kmp_int32 cncl_kind)
 
kmp_int32 __kmpc_cancel_barrier (ident_t *loc, kmp_int32 gtid)
 
int __kmp_get_cancellation_status (int cancel_kind)
 

Function Documentation

◆ __kmp_get_cancellation_status()

int __kmp_get_cancellation_status ( int  cancel_kind)
Parameters
loc_reflocation of the original task directive
gtidGlobal thread ID of encountering thread
Returns
returns true if a matching cancellation request has been flagged in the RTL and the encountering thread has to cancel..

Query function to query the current status of cancellation requests. Can be used to implement the following pattern:

if (kmp_get_cancellation_status(kmp_cancel_parallel)) { perform_cleanup(); #pragma omp cancellation point parallel }

Definition at line 309 of file kmp_cancel.cpp.

References __kmp_entry_thread(), __kmp_omp_cancellation, cancel_loop, cancel_parallel, kmp_taskgroup::cancel_request, cancel_sections, cancel_taskgroup, kmp_team::t, and task::th.

Referenced by FTN_GET_CANCELLATION_STATUS().

◆ __kmpc_cancel()

kmp_int32 __kmpc_cancel ( ident_t loc_ref,
kmp_int32  gtid,
kmp_int32  cncl_kind 
)
Parameters
loc_reflocation of the original task directive
gtidGlobal thread ID of encountering thread
cncl_kindCancellation kind (parallel, for, sections, taskgroup)
Returns
returns true if the cancellation request has been activated and the execution thread needs to proceed to the end of the canceled region.

Request cancellation of the binding OpenMP region.

Definition at line 29 of file kmp_cancel.cpp.

References __kmp_get_gtid, __kmp_omp_cancellation, __kmp_threads, __ompt_get_task_info_internal(), cancel_loop, cancel_noreq, cancel_parallel, kmp_taskgroup::cancel_request, cancel_sections, cancel_taskgroup, KC_TRACE, KMP_ASSERT, KMP_DEBUG_ASSERT, ompt_callbacks, ompt_enabled, OMPT_GET_RETURN_ADDRESS, kmp_team::t, task::th, and type.

◆ __kmpc_cancel_barrier()

kmp_int32 __kmpc_cancel_barrier ( ident_t loc,
kmp_int32  gtid 
)
Parameters
loc_reflocation of the original task directive
gtidGlobal thread ID of encountering thread
Returns
returns true if a matching cancellation request has been flagged in the RTL and the encountering thread has to cancel..

Barrier with cancellation point to send threads from the barrier to the end of the parallel region. Needs a special code pattern as documented in the design document for the cancellation feature.

Definition at line 243 of file kmp_cancel.cpp.

References __kmp_get_gtid, __kmp_omp_cancellation, __kmp_threads, __kmpc_barrier(), cancel_loop, cancel_noreq, cancel_parallel, cancel_sections, cancel_taskgroup, KMP_ASSERT, KMP_ATOMIC_LD_RLX, KMP_DEBUG_ASSERT, loc, ret, and kmp_team::t.

◆ __kmpc_cancellationpoint()

kmp_int32 __kmpc_cancellationpoint ( ident_t loc_ref,
kmp_int32  gtid,
kmp_int32  cncl_kind 
)
Parameters
loc_reflocation of the original task directive
gtidGlobal thread ID of encountering thread
cncl_kindCancellation kind (parallel, for, sections, taskgroup)
Returns
returns true if a matching cancellation request has been flagged in the RTL and the encountering thread has to cancel..

Cancellation point for the encountering thread.

Definition at line 135 of file kmp_cancel.cpp.

References __kmp_get_gtid, __kmp_omp_cancellation, __kmp_threads, __ompt_get_task_info_internal(), cancel_loop, cancel_noreq, cancel_parallel, kmp_taskgroup::cancel_request, cancel_sections, cancel_taskgroup, KC_TRACE, KMP_ASSERT, KMP_DEBUG_ASSERT, ompt_callbacks, ompt_enabled, OMPT_GET_RETURN_ADDRESS, kmp_team::t, task::th, and type.