3.1.18 omp_get_ancestor_thread_num – Ancestor thread ID

Description:

This function returns the thread identification number for the given nesting level of the current thread. For values of level outside zero to omp_get_level -1 is returned; if level is omp_get_level the result is identical to omp_get_thread_num.

C/C++
Prototype:int omp_get_ancestor_thread_num(int level);
Fortran:
Interface:integer function omp_get_ancestor_thread_num(level)
integer level
See also:

omp_get_level – Obtain the current nesting level, omp_get_thread_num – Current thread ID, omp_get_team_size – Number of threads in a team

Reference:

OpenMP specification v4.5, Section 3.2.18.