Returns the thread number of the ancestor of the current thread at a given nested level. Returns -1 if the nested level is not within the range of 0 and the current thread's nested level as returned by omp_get_level.
int omp_get_ancestor_thread_num(int level);