From 1f037e495aca137d5300d0519453ccaeb1b8abe6 Mon Sep 17 00:00:00 2001 From: Andrey Churbanov Date: Tue, 10 Mar 2015 09:15:26 +0000 Subject: [PATCH] cleanup: usages of mask size wrapped into macros llvm-svn: 231775 --- openmp/runtime/src/kmp.h | 2 ++ openmp/runtime/src/kmp_affinity.cpp | 4 ++-- openmp/runtime/src/kmp_settings.c | 2 +- openmp/runtime/src/z_Linux_util.c | 14 +++++++------- openmp/runtime/src/z_Windows_NT_util.c | 4 ++-- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/openmp/runtime/src/kmp.h b/openmp/runtime/src/kmp.h index e3c1401..1addf4b 100644 --- a/openmp/runtime/src/kmp.h +++ b/openmp/runtime/src/kmp.h @@ -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 diff --git a/openmp/runtime/src/kmp_affinity.cpp b/openmp/runtime/src/kmp_affinity.cpp index 7f1a29d..eb87c2f 100644 --- a/openmp/runtime/src/kmp_affinity.cpp +++ b/openmp/runtime/src/kmp_affinity.cpp @@ -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; } diff --git a/openmp/runtime/src/kmp_settings.c b/openmp/runtime/src/kmp_settings.c index b6928d4..f22fdc2 100644 --- a/openmp/runtime/src/kmp_settings.c +++ b/openmp/runtime/src/kmp_settings.c @@ -5101,7 +5101,7 @@ __kmp_env_initialize( char const * string ) { // 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 ); diff --git a/openmp/runtime/src/z_Linux_util.c b/openmp/runtime/src/z_Linux_util.c index 4e3236d..75b61f1 100644 --- a/openmp/runtime/src/z_Linux_util.c +++ b/openmp/runtime/src/z_Linux_util.c @@ -277,7 +277,7 @@ __kmp_affinity_determine_capable(const char *env_var) __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 char *env_var) __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 char *env_var) __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 char *env_var) __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 char *env_var) // // 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 diff --git a/openmp/runtime/src/z_Windows_NT_util.c b/openmp/runtime/src/z_Windows_NT_util.c index 62fd0e4..023a4db 100644 --- a/openmp/runtime/src/z_Windows_NT_util.c +++ b/openmp/runtime/src/z_Windows_NT_util.c @@ -763,9 +763,9 @@ __kmp_affinity_determine_capable( const char *env_var ) // #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, ( -- 2.7.4