omp_get_ancestor_thread_num
int omp_get_ancestor_thread_num(int level)
Returns, for a given nested level of the current thread, the thread number of the ancestor or the current thread.
OpenMP API Index