[Openmp-commits] [openmp] [OpenMP][AIX] Affinity implementation for AIX (PR #84984)

Brad Smith via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 14 23:18:06 PDT 2024


================
@@ -272,7 +275,30 @@ void __kmp_affinity_determine_capable(const char *env_var) {
   }
 }
 
-#endif // KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED
+#elif KMP_OS_AIX
+void __kmp_affinity_determine_capable(const char *env_var) {
+  // All versions of AIX support bindprocessor().
+
+  size_t mask_size = __kmp_xproc / CHAR_BIT;
+  // Round up to byte boundary.
+  if (__kmp_xproc % CHAR_BIT)
+    ++mask_size;
+
+  // Round up to the mask_size_type boundary.
+  if (mask_size % sizeof(__kmp_affin_mask_size))
+    mask_size += sizeof(__kmp_affin_mask_size) -
+                 mask_size % sizeof(__kmp_affin_mask_size);
+  KMP_AFFINITY_ENABLE(mask_size);
+  KA_TRACE(10,
+           ("__kmp_affinity_determine_capable: "
+            "AIX OS affinity interface bindprocessor functional (mask size = "
+            "%" KMP_SIZE_T_SPEC ").\n",
+            __kmp_affin_mask_size));
+}
+
+#endif // KMP_OS_AIX
----------------
brad0 wrote:

Same.

https://github.com/llvm/llvm-project/pull/84984


More information about the Openmp-commits mailing list