[Openmp-commits] [openmp] r227467 - enable environment variable KMP_PLACE_THREADS also for non-MIC architectures

Andrey Churbanov Andrey.Churbanov at intel.com
Thu Jan 29 09:14:59 PST 2015


Author: achurbanov
Date: Thu Jan 29 11:14:58 2015
New Revision: 227467

URL: http://llvm.org/viewvc/llvm-project?rev=227467&view=rev
Log:
enable environment variable KMP_PLACE_THREADS also for non-MIC architectures

Modified:
    openmp/trunk/runtime/src/kmp.h
    openmp/trunk/runtime/src/kmp_affinity.cpp
    openmp/trunk/runtime/src/kmp_csupport.c
    openmp/trunk/runtime/src/kmp_global.c
    openmp/trunk/runtime/src/kmp_settings.c

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=227467&r1=227466&r2=227467&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Thu Jan 29 11:14:58 2015
@@ -782,11 +782,9 @@ typedef enum kmp_cancel_kind_t {
 } kmp_cancel_kind_t;
 #endif // OMP_40_ENABLED
 
-#if KMP_MIC
 extern unsigned int __kmp_place_num_cores;
 extern unsigned int __kmp_place_num_threads_per_core;
 extern unsigned int __kmp_place_core_offset;
-#endif
 
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
@@ -2578,7 +2576,7 @@ extern int        __kmp_bt_intervals;
 extern int        __kmp_zero_bt;        /* whether blocktime has been forced to zero */
 #endif /* KMP_ADJUST_BLOCKTIME */
 #ifdef KMP_DFLT_NTH_CORES
-extern int        __kmp_ncores;         /* Number of physical procs in HT machine */
+extern int        __kmp_ncores;         /* Total number of cores for threads placement */
 #endif
 extern int        __kmp_abort_delay;    /* Number of millisecs to delay on abort for VTune */
 

Modified: openmp/trunk/runtime/src/kmp_affinity.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.cpp?rev=227467&r1=227466&r2=227467&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp (original)
+++ openmp/trunk/runtime/src/kmp_affinity.cpp Thu Jan 29 11:14:58 2015
@@ -3327,9 +3327,6 @@ __kmp_affinity_process_placelist(kmp_aff
 #undef ADD_MASK
 #undef ADD_MASK_OSID
 
-
-# if KMP_MIC
-
 static void
 __kmp_apply_thread_places(AddrUnsPair **pAddr, int depth)
 {
@@ -3350,7 +3347,7 @@ __kmp_apply_thread_places(AddrUnsPair **
     if ( __kmp_place_num_threads_per_core == 0 ) {
         __kmp_place_num_threads_per_core = __kmp_nThreadsPerCore;  // use all HW contexts
     }
-    if ( __kmp_place_core_offset + __kmp_place_num_cores > nCoresPerPkg ) {
+    if ( __kmp_place_core_offset + __kmp_place_num_cores > (unsigned int)nCoresPerPkg ) {
         KMP_WARNING( AffThrPlaceManyCores );
         return;
     }
@@ -3360,11 +3357,11 @@ __kmp_apply_thread_places(AddrUnsPair **
     int i, j, k, n_old = 0, n_new = 0;
     for ( i = 0; i < nPackages; ++i ) {
         for ( j = 0; j < nCoresPerPkg; ++j ) {
-            if ( j < __kmp_place_core_offset || j >= __kmp_place_core_offset + __kmp_place_num_cores ) {
+            if ( (unsigned int)j < __kmp_place_core_offset || (unsigned int)j >= __kmp_place_core_offset + __kmp_place_num_cores ) {
                 n_old += __kmp_nThreadsPerCore;   // skip not-requested core
             } else {
                 for ( k = 0; k < __kmp_nThreadsPerCore; ++k ) {
-                    if ( k < __kmp_place_num_threads_per_core ) {
+                    if ( (unsigned int)k < __kmp_place_num_threads_per_core ) {
                         newAddr[n_new] = (*pAddr)[n_old];   // copy requested core' data to new location
                         n_new++;
                     }
@@ -3382,8 +3379,6 @@ __kmp_apply_thread_places(AddrUnsPair **
     *pAddr = newAddr;      // replace old topology with new one
 }
 
-# endif /* KMP_MIC */
-
 
 static AddrUnsPair *address2os = NULL;
 static int           * procarr = NULL;
@@ -3705,9 +3700,7 @@ __kmp_aux_affinity_initialize(void)
         return;
     }
 
-# if KMP_MIC
     __kmp_apply_thread_places(&address2os, depth);
-# endif
 
     //
     // Create the table of masks, indexed by thread Id.

Modified: openmp/trunk/runtime/src/kmp_csupport.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_csupport.c?rev=227467&r1=227466&r2=227467&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_csupport.c (original)
+++ openmp/trunk/runtime/src/kmp_csupport.c Thu Jan 29 11:14:58 2015
@@ -2157,14 +2157,12 @@ __kmpc_get_parent_taskid() {
 
 void __kmpc_place_threads(int nC, int nT, int nO)
 {
-#if KMP_MIC
     if ( ! __kmp_init_serial ) {
         __kmp_serial_initialize();
     }
     __kmp_place_num_cores = nC;
     __kmp_place_num_threads_per_core = nT;
     __kmp_place_core_offset = nO;
-#endif
 }
 
 // end of file //

Modified: openmp/trunk/runtime/src/kmp_global.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_global.c?rev=227467&r1=227466&r2=227467&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_global.c (original)
+++ openmp/trunk/runtime/src/kmp_global.c Thu Jan 29 11:14:58 2015
@@ -249,11 +249,9 @@ kmp_nested_proc_bind_t __kmp_nested_proc
 int __kmp_affinity_num_places = 0;
 #endif
 
-#if KMP_MIC
 unsigned int __kmp_place_num_cores = 0;
 unsigned int __kmp_place_num_threads_per_core = 0;
 unsigned int __kmp_place_core_offset = 0;
-#endif
 
 kmp_tasking_mode_t __kmp_tasking_mode = tskm_task_teams;
 

Modified: openmp/trunk/runtime/src/kmp_settings.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.c?rev=227467&r1=227466&r2=227467&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.c (original)
+++ openmp/trunk/runtime/src/kmp_settings.c Thu Jan 29 11:14:58 2015
@@ -4205,7 +4205,6 @@ __kmp_stg_print_speculative_statsfile( k
 
 #endif // KMP_USE_ADAPTIVE_LOCKS
 
-#if KMP_MIC
 // -------------------------------------------------------------------------------------------------
 // KMP_PLACE_THREADS
 // -------------------------------------------------------------------------------------------------
@@ -4343,7 +4342,6 @@ __kmp_stg_print_place_threads( kmp_str_b
 */
     }
 }
-#endif
 
 #if USE_ITT_BUILD
 // -------------------------------------------------------------------------------------------------
@@ -4561,9 +4559,7 @@ static kmp_setting_t __kmp_stg_table[] =
     { "KMP_SPECULATIVE_STATSFILE",         __kmp_stg_parse_speculative_statsfile,__kmp_stg_print_speculative_statsfile,  NULL, 0, 0 },
 #endif
 #endif // KMP_USE_ADAPTIVE_LOCKS
-#if KMP_MIC
     { "KMP_PLACE_THREADS",                 __kmp_stg_parse_place_threads,      __kmp_stg_print_place_threads,      NULL, 0, 0 },
-#endif
 #if USE_ITT_BUILD
     { "KMP_FORKJOIN_FRAMES",               __kmp_stg_parse_forkjoin_frames,    __kmp_stg_print_forkjoin_frames,    NULL, 0, 0 },
     { "KMP_FORKJOIN_FRAMES_MODE",          __kmp_stg_parse_forkjoin_frames_mode,__kmp_stg_print_forkjoin_frames_mode,  NULL, 0, 0 },





More information about the Openmp-commits mailing list