[Openmp-commits] [openmp] r231775 - cleanup: usages of mask size wrapped into macros

Andrey Churbanov Andrey.Churbanov at intel.com
Tue Mar 10 02:15:27 PDT 2015


Author: achurbanov
Date: Tue Mar 10 04:15:26 2015
New Revision: 231775

URL: http://llvm.org/viewvc/llvm-project?rev=231775&view=rev
Log:
cleanup: usages of mask size wrapped into macros

Modified:
    openmp/trunk/runtime/src/kmp.h
    openmp/trunk/runtime/src/kmp_affinity.cpp
    openmp/trunk/runtime/src/kmp_settings.c
    openmp/trunk/runtime/src/z_Linux_util.c
    openmp/trunk/runtime/src/z_Windows_NT_util.c

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=231775&r1=231774&r2=231775&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Tue Mar 10 04:15:26 2015
@@ -489,6 +489,8 @@ typedef int PACKED_REDUCTION_METHOD_T;
 
 extern size_t __kmp_affin_mask_size;
 # define KMP_AFFINITY_CAPABLE() (__kmp_affin_mask_size > 0)
+# define KMP_AFFINITY_DISABLE() (__kmp_affin_mask_size = 0)
+# define KMP_AFFINITY_ENABLE(mask_size) (__kmp_affin_mask_size = mask_size)
 # define KMP_CPU_SETSIZE        (__kmp_affin_mask_size * CHAR_BIT)
 
 # if KMP_OS_LINUX

Modified: openmp/trunk/runtime/src/kmp_affinity.cpp
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_affinity.cpp?rev=231775&r1=231774&r2=231775&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_affinity.cpp (original)
+++ openmp/trunk/runtime/src/kmp_affinity.cpp Tue Mar 10 04:15:26 2015
@@ -3426,7 +3426,7 @@ __kmp_aux_affinity_initialize(void)
                     KMP_WARNING(ErrorInitializeAffinity);
                 }
                 __kmp_affinity_type = affinity_none;
-                __kmp_affin_mask_size = 0;
+                KMP_AFFINITY_DISABLE();
                 return;
             }
         }
@@ -3700,7 +3700,7 @@ __kmp_aux_affinity_initialize(void)
             KMP_WARNING(ErrorInitializeAffinity);
         }
         __kmp_affinity_type = affinity_none;
-        __kmp_affin_mask_size = 0;
+        KMP_AFFINITY_DISABLE();
         return;
     }
 

Modified: openmp/trunk/runtime/src/kmp_settings.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_settings.c?rev=231775&r1=231774&r2=231775&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_settings.c (original)
+++ openmp/trunk/runtime/src/kmp_settings.c Tue Mar 10 04:15:26 2015
@@ -5101,7 +5101,7 @@ __kmp_env_initialize( char const * strin
         //
         const char *var = "KMP_AFFINITY";
         if ( __kmp_affinity_type == affinity_disabled ) {
-            __kmp_affin_mask_size = 0;  // should already be 0
+            KMP_AFFINITY_DISABLE();
         }
         else if ( ! KMP_AFFINITY_CAPABLE() ) {
             __kmp_affinity_determine_capable( var );

Modified: openmp/trunk/runtime/src/z_Linux_util.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Linux_util.c?rev=231775&r1=231774&r2=231775&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Tue Mar 10 04:15:26 2015
@@ -277,7 +277,7 @@ __kmp_affinity_determine_capable(const c
                 __kmp_msg_null
             );
         }
-        __kmp_affin_mask_size = 0;  // should already be 0
+        KMP_AFFINITY_DISABLE();
         KMP_INTERNAL_FREE(buf);
         return;
     }
@@ -305,11 +305,11 @@ __kmp_affinity_determine_capable(const c
                         __kmp_msg_null
                     );
                 }
-                __kmp_affin_mask_size = 0;  // should already be 0
+                KMP_AFFINITY_DISABLE();
                 KMP_INTERNAL_FREE(buf);
             }
             if (errno == EFAULT) {
-                __kmp_affin_mask_size = gCode;
+                KMP_AFFINITY_ENABLE(gCode);
                 KA_TRACE(10, ( "__kmp_affinity_determine_capable: "
                   "affinity supported (mask size %d)\n",
                   (int)__kmp_affin_mask_size));
@@ -353,7 +353,7 @@ __kmp_affinity_determine_capable(const c
                         __kmp_msg_null
                     );
                 }
-                __kmp_affin_mask_size = 0;  // should already be 0
+                KMP_AFFINITY_DISABLE();
                 KMP_INTERNAL_FREE(buf);
                 return;
             }
@@ -384,12 +384,12 @@ __kmp_affinity_determine_capable(const c
                         __kmp_msg_null
                     );
                 }
-                __kmp_affin_mask_size = 0;  // should already be 0
+                KMP_AFFINITY_DISABLE();
                 KMP_INTERNAL_FREE(buf);
                 return;
             }
             if (errno == EFAULT) {
-                __kmp_affin_mask_size = gCode;
+                KMP_AFFINITY_ENABLE(gCode);
                 KA_TRACE(10, ( "__kmp_affinity_determine_capable: "
                   "affinity supported (mask size %d)\n",
                    (int)__kmp_affin_mask_size));
@@ -405,7 +405,7 @@ __kmp_affinity_determine_capable(const c
     //
     // Affinity is not supported
     //
-    __kmp_affin_mask_size = 0;
+    KMP_AFFINITY_DISABLE();
     KA_TRACE(10, ( "__kmp_affinity_determine_capable: "
       "cannot determine mask size - affinity not supported\n"));
     if (__kmp_affinity_verbose || (__kmp_affinity_warnings

Modified: openmp/trunk/runtime/src/z_Windows_NT_util.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/z_Windows_NT_util.c?rev=231775&r1=231774&r2=231775&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Windows_NT_util.c (original)
+++ openmp/trunk/runtime/src/z_Windows_NT_util.c Tue Mar 10 04:15:26 2015
@@ -763,9 +763,9 @@ __kmp_affinity_determine_capable( const
     //
 
 #if KMP_GROUP_AFFINITY
-    __kmp_affin_mask_size = __kmp_num_proc_groups * sizeof(kmp_affin_mask_t);
+    KMP_AFFINITY_ENABLE(__kmp_num_proc_groups*sizeof(kmp_affin_mask_t));
 #else
-    __kmp_affin_mask_size = sizeof(kmp_affin_mask_t);
+    KMP_AFFINITY_ENABLE(sizeof(kmp_affin_mask_t));
 #endif
 
     KA_TRACE( 10, (





More information about the Openmp-commits mailing list