In Openmp is there a way to find out the place to which the master thread is assigned?

With openmp’s thread affinity mechanisms, the master thread is assigned to the place where the parent of the master thread is running (where the set of places is specified by OMP_PLACES). It is my understanding that effectively this means that the OS determines the place where the master thread gets executed. Is there a way to find from inside your C++ code the actual place or hardware thread to which this master thread is binded? Thanks


How about omp_get_place_num()?
The OpenMP specification states:

The omp_get_place_num routine returns the place number of the place to
which the encountering thread is bound.

Another possibility is to set the OMP_DISPLAY_AFFINITY environment variable to true which will cause the affinity information to be displayed.