[Openmp-commits] [PATCH] D34154: Set affinity to none/false in child processes

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Jun 15 14:51:50 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL305513: Set affinity to none/false in child processes (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D34154?vs=102364&id=102726#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34154

Files:
  openmp/trunk/runtime/src/z_Linux_util.cpp


Index: openmp/trunk/runtime/src/z_Linux_util.cpp
===================================================================
--- openmp/trunk/runtime/src/z_Linux_util.cpp
+++ openmp/trunk/runtime/src/z_Linux_util.cpp
@@ -1280,11 +1280,22 @@
 
   ++__kmp_fork_count;
 
-#if KMP_AFFINITY_SUPPORTED && KMP_OS_LINUX
+#if KMP_AFFINITY_SUPPORTED
+#if KMP_OS_LINUX
   // reset the affinity in the child to the initial thread
   // affinity in the parent
   kmp_set_thread_affinity_mask_initial();
 #endif
+  // Set default not to bind threads tightly in the child (we’re expecting
+  // over-subscription after the fork and this can improve things for
+  // scripting languages that use OpenMP inside process-parallel code).
+  __kmp_affinity_type = affinity_none;
+#if OMP_40_ENABLED
+  if (__kmp_nested_proc_bind.bind_types != NULL) {
+    __kmp_nested_proc_bind.bind_types[0] = proc_bind_false;
+  }
+#endif // OMP_40_ENABLED
+#endif // KMP_AFFINITY_SUPPORTED
 
   __kmp_init_runtime = FALSE;
 #if KMP_USE_MONITOR


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34154.102726.patch
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20170615/6a0123fd/attachment.bin>


More information about the Openmp-commits mailing list