[Openmp-commits] [openmp] r295339 - Added an option to bind initial thread at the start of application

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 16 09:08:40 PST 2017


Author: achurbanov
Date: Thu Feb 16 11:08:40 2017
New Revision: 295339

URL: http://llvm.org/viewvc/llvm-project?rev=295339&view=rev
Log:
Added an option to bind initial thread at the start of application
via setting envirable KMP_INITIAL_THREAD_BIND=1.

Differential Revision: https://reviews.llvm.org/D29665

Modified:
    openmp/trunk/runtime/src/kmp_csupport.cpp

Modified: openmp/trunk/runtime/src/kmp_csupport.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.cpp?rev=295339&r1=295338&r2=295339&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.cpp (original)
+++ openmp/trunk/runtime/src/kmp_csupport.cpp Thu Feb 16 11:08:40 2017
@@ -46,10 +46,15 @@
 void
 __kmpc_begin(ident_t *loc, kmp_int32 flags)
 {
-    // By default __kmp_ignore_mppbeg() returns TRUE.
-    if (__kmp_ignore_mppbeg() == FALSE) {
+    // By default __kmpc_begin() is no-op.
+    char *env;
+    if ((env = getenv( "KMP_INITIAL_THREAD_BIND" )) != NULL &&
+        __kmp_str_match_true( env )) {
+        __kmp_middle_initialize();
+        KC_TRACE(10, ("__kmpc_begin: middle initialization called\n" ));
+    } else if (__kmp_ignore_mppbeg() == FALSE) {
+        // By default __kmp_ignore_mppbeg() returns TRUE.
         __kmp_internal_begin();
-
         KC_TRACE( 10, ("__kmpc_begin: called\n" ) );
     }
 }




More information about the Openmp-commits mailing list