[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
Wed May 25 12:41:27 PDT 2022


devnexen created this revision.
devnexen added a reviewer: jlpeyton.
Herald added subscribers: guansong, yaxunl.
Herald added a project: All.
devnexen requested review of this revision.
Herald added a reviewer: jdoerfert.
Herald added subscribers: openmp-commits, sstefan1.
Herald added a project: OpenMP.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126408

Files:
  openmp/runtime/src/kmp_platform.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_OS_LINUX || KMP_OS_FREEBSD_SCHED
   return sched_getcpu();
 #elif KMP_OS_WINDOWS
   PROCESSOR_NUMBER pn;
Index: openmp/runtime/src/kmp_platform.h
===================================================================
--- openmp/runtime/src/kmp_platform.h
+++ openmp/runtime/src/kmp_platform.h
@@ -25,6 +25,8 @@
 #define KMP_OS_HURD 0
 #define KMP_OS_UNIX 0 /* disjunction of KMP_OS_LINUX, KMP_OS_DARWIN etc. */
 
+#define KMP_OS_FREEBSD_SCHED 0
+
 #ifdef _WIN32
 #undef KMP_OS_WINDOWS
 #define KMP_OS_WINDOWS 1
@@ -53,6 +55,10 @@
 #if (defined __FreeBSD__)
 #undef KMP_OS_FREEBSD
 #define KMP_OS_FREEBSD 1
+#if __FreeBSD_version >= 1301000
+#undef KMP_OS_FREEBSD_SCHED
+#define KMP_OS_FREEBSD_SCHED 1
+#endif
 #endif
 
 #if (defined __NetBSD__)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126408.432087.patch
Type: text/x-patch
Size: 1097 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20220525/7f7c062c/attachment.bin>


More information about the Openmp-commits mailing list