[Openmp-commits] [PATCH] D126408: [OPENMP] omp_get_proc_id uses sched_getcpu fallback on FreeBSD 13.1 and above
David CARLIER via Phabricator via Openmp-commits
openmp-commits at lists.llvm.org
Thu Jun 2 04:01:39 PDT 2022
devnexen updated this revision to Diff 433712.
devnexen added a comment.
changes from feedback
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D126408/new/
https://reviews.llvm.org/D126408
Files:
openmp/runtime/src/kmp_os.h
openmp/runtime/src/ompt-general.cpp
Index: openmp/runtime/src/ompt-general.cpp
===================================================================
--- openmp/runtime/src/ompt-general.cpp
+++ openmp/runtime/src/ompt-general.cpp
@@ -790,7 +790,7 @@
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;
Index: openmp/runtime/src/kmp_os.h
===================================================================
--- openmp/runtime/src/kmp_os.h
+++ openmp/runtime/src/kmp_os.h
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126408.433712.patch
Type: text/x-patch
Size: 931 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220602/46f73a80/attachment.bin>
More information about the Openmp-commits
mailing list