[OpenMP] omp_get_proc_id uses sched_getcpu fallback on FreeBSD 13.1 and above.

Reviewers: jlpeyton, jdoerfert

Reviewed-By: jlpeyton

Differential-Revision: https://reviews.llvm.org/D126408
This commit is contained in:
David CARLIER 2022-06-02 17:10:29 +01:00
parent e27ce28139
commit 2ba5d820e2
2 changed files with 7 additions and 1 deletions

View File

@ -87,6 +87,12 @@
#define KMP_GROUP_AFFINITY 0
#endif
#if (KMP_OS_LINUX || (KMP_OS_FREEBSD && __FreeBSD_version >= 1301000))
#define KMP_HAVE_SCHED_GETCPU 1
#else
#define KMP_HAVE_SCHED_GETCPU 0
#endif
/* Check for quad-precision extension. */
#define KMP_HAVE_QUAD 0
#if KMP_ARCH_X86 || KMP_ARCH_X86_64

View File

@ -790,7 +790,7 @@ OMPT_API_ROUTINE int ompt_get_partition_place_nums(int place_nums_size,
OMPT_API_ROUTINE int ompt_get_proc_id(void) {
if (!ompt_enabled.enabled || __kmp_get_gtid() < 0)
return -1;
#if KMP_OS_LINUX
#if KMP_HAVE_SCHED_GETCPU
return sched_getcpu();
#elif KMP_OS_WINDOWS
PROCESSOR_NUMBER pn;