LLVM OpenMP 19.0.0git
Functions
Thread Information

These functions return information about the currently executing thread. More...

Functions

kmp_int32 __kmpc_global_thread_num (ident_t *loc)
 
kmp_int32 __kmpc_global_num_threads (ident_t *loc)
 
kmp_int32 __kmpc_bound_thread_num (ident_t *loc)
 
kmp_int32 __kmpc_bound_num_threads (ident_t *loc)
 
kmp_int32 __kmpc_in_parallel (ident_t *loc)
 

Detailed Description

These functions return information about the currently executing thread.

Function Documentation

◆ __kmpc_bound_num_threads()

kmp_int32 __kmpc_bound_num_threads ( ident_t loc)
Parameters
locSource location information.
Returns
The number of threads in the innermost active parallel construct.

Definition at line 145 of file kmp_csupport.cpp.

References __kmp_entry_thread(), and KC_TRACE.

Referenced by FTN_GET_NUM_THREADS().

◆ __kmpc_bound_thread_num()

kmp_int32 __kmpc_bound_thread_num ( ident_t loc)
Parameters
locSource location information.
Returns
The thread number of the calling thread in the innermost active parallel construct.

Definition at line 135 of file kmp_csupport.cpp.

References __kmp_entry_gtid, __kmp_tid_from_gtid(), and KC_TRACE.

◆ __kmpc_global_num_threads()

kmp_int32 __kmpc_global_num_threads ( ident_t loc)
Parameters
locSource location information.
Returns
The number of threads under control of the OpenMP* runtime

This function can be called in any context. It returns the total number of threads under the control of the OpenMP runtime. That is not a number that can be determined by any OpenMP standard calls, since the library may be called from more than one non-OpenMP thread, and this reflects the total over all such calls. Similarly the runtime maintains underlying threads even when they are not active (since the cost of creating and destroying OS threads is high), this call counts all such threads even if they are not waiting for work.

Definition at line 122 of file kmp_csupport.cpp.

References __kmp_all_nth, KC_TRACE, and TCR_4.

◆ __kmpc_global_thread_num()

kmp_int32 __kmpc_global_thread_num ( ident_t loc)
Parameters
locSource location information.
Returns
The global thread index of the active thread.

This function can be called in any context.

If the runtime has ony been entered at the outermost level from a single (necessarily non-OpenMP*) thread, then the thread number is that which would be returned by omp_get_thread_num() in the outermost active parallel construct. (Or zero if there is no active parallel construct, since the primary thread is necessarily thread zero).

If multiple non-OpenMP threads all enter an OpenMP construct then this will be a unique thread identifier among all the threads created by the OpenMP runtime (but the value cannot be defined in terms of OpenMP thread ids returned by omp_get_thread_num()).

Definition at line 100 of file kmp_csupport.cpp.

References __kmp_entry_gtid, and KC_TRACE.

Referenced by check_num_teams(), main(), and omp_task_entry().

◆ __kmpc_in_parallel()

kmp_int32 __kmpc_in_parallel ( ident_t loc)
Parameters
locSource location information.
Returns
1 if this thread is executing inside an active parallel region, zero if not.

Definition at line 219 of file kmp_csupport.cpp.

References __kmp_entry_thread().

Referenced by __kmpc_fork_call().