[Openmp-commits] [PATCH] D38292: KMP_HW_SUBSET vs KMP_PLACE_THREADS rival envirables fix

Jonathan Peyton via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Fri Oct 6 12:25:22 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL315091: KMP_HW_SUBSET vs KMP_PLACE_THREADS rival envirables fix (authored by jlpeyton).

Changed prior to commit:
  https://reviews.llvm.org/D38292?vs=117890&id=118055#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D38292

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


Index: openmp/trunk/runtime/src/kmp_settings.cpp
===================================================================
--- openmp/trunk/runtime/src/kmp_settings.cpp
+++ openmp/trunk/runtime/src/kmp_settings.cpp
@@ -4114,14 +4114,13 @@
                                       void *data) {
   // Value example: 1s,5c at 3,2T
   // Which means "use 1 socket, 5 cores with offset 3, 2 threads per core"
-  static int parsed = 0;
+  kmp_setting_t **rivals = (kmp_setting_t **)data;
   if (strcmp(name, "KMP_PLACE_THREADS") == 0) {
     KMP_INFORM(EnvVarDeprecated, name, "KMP_HW_SUBSET");
-    if (parsed == 1) {
-      return; // already parsed KMP_HW_SUBSET
-    }
   }
-  parsed = 1;
+  if (__kmp_stg_check_rivals(name, value, rivals)) {
+    return;
+  }
 
   char *components[MAX_T_LEVEL];
   char const *digits = "0123456789";
@@ -4731,6 +4730,24 @@
       kmp_all_threads->data = CCAST(kmp_setting_t **, rivals);
     }
 
+    { // Initialize KMP_HW_SUBSET and KMP_PLACE_THREADS
+      // 1st priority
+      kmp_setting_t *kmp_hw_subset = __kmp_stg_find("KMP_HW_SUBSET");
+      // 2nd priority
+      kmp_setting_t *kmp_place_threads = __kmp_stg_find("KMP_PLACE_THREADS");
+
+      // !!! volatile keyword is Intel (R) C Compiler bug CQ49908 workaround.
+      static kmp_setting_t *volatile rivals[3];
+      int i = 0;
+
+      rivals[i++] = kmp_hw_subset;
+      rivals[i++] = kmp_place_threads;
+      rivals[i++] = NULL;
+
+      kmp_hw_subset->data = CCAST(kmp_setting_t **, rivals);
+      kmp_place_threads->data = CCAST(kmp_setting_t **, rivals);
+    }
+
 #if KMP_AFFINITY_SUPPORTED
     { // Initialize KMP_AFFINITY, GOMP_CPU_AFFINITY, and OMP_PROC_BIND data.
       kmp_setting_t *kmp_affinity =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38292.118055.patch
Type: text/x-patch
Size: 1707 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20171006/7863a04b/attachment.bin>


More information about the Openmp-commits mailing list