Thread Information

## 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

  loc | Source location information.

Returns
  The number of threads in the innermost active parallel construct.

Definition at line 143 of file kmp_csupport.cpp.

## __kmpc_bound_thread_num()

kmp_int32 __kmpc_bound_thread_num | ( | ident_t * | loc | ) |

Parameters

  loc | Source location information.

Returns
  The thread number of the calling thread in the innermost active parallel construct.

Definition at line 133 of file kmp_csupport.cpp.

## __kmpc_global_num_threads()

kmp_int32 __kmpc_global_num_threads | ( | ident_t * | loc | ) |

Parameters

  loc | Source 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 120 of file kmp_csupport.cpp.

## __kmpc_global_thread_num()

kmp_int32 __kmpc_global_thread_num | ( | ident_t * | loc | ) |

Parameters

  loc | Source 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 master 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 cannote be defined in terms of OpenMP thread ids returned by omp_get_thread_num()).

Definition at line 98 of file kmp_csupport.cpp.

## __kmpc_in_parallel()

kmp_int32 __kmpc_in_parallel | ( | ident_t * | loc | ) |

Parameters

  loc | Source location information.

Returns
  1 if this thread is executing inside an active parallel region, zero if not.

Definition at line 217 of file kmp_csupport.cpp.