[Openmp-commits] [openmp] r231778 - cleanup: removed unused function __kmp_change_thread_affinity_mask

Andrey Churbanov Andrey.Churbanov at intel.com
Tue Mar 10 02:31:21 PDT 2015


Author: achurbanov
Date: Tue Mar 10 04:31:21 2015
New Revision: 231778

URL: http://llvm.org/viewvc/llvm-project?rev=231778&view=rev
Log:
cleanup: removed unused function __kmp_change_thread_affinity_mask

Modified:
    openmp/trunk/runtime/src/i18n/en_US.txt
    openmp/trunk/runtime/src/kmp.h
    openmp/trunk/runtime/src/z_Linux_util.c
    openmp/trunk/runtime/src/z_Windows_NT_util.c

Modified: openmp/trunk/runtime/src/i18n/en_US.txt
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/i18n/en_US.txt?rev=231778&r1=231777&r2=231778&view=diff
==============================================================================
--- openmp/trunk/runtime/src/i18n/en_US.txt (original)
+++ openmp/trunk/runtime/src/i18n/en_US.txt Tue Mar 10 04:31:21 2015
@@ -313,7 +313,7 @@ OBSOLETE                     "%1$s: OS p
 OBSOLETE                     "%1$s: OS proc %2$d maps to package %3$d [core %4$d] thread %5$d"
 OBSOLETE                     "%1$s: OS proc %2$d maps to package %3$d core %4$d thread %5$d"
 OSProcMapToPack              "%1$s: OS proc %2$d maps to %3$s"
-ChangeAffMask                "%1$s: Internal thread %2$d changed affinity mask from %3$s to %4$s"
+OBSOLETE                     "%1$s: Internal thread %2$d changed affinity mask from %3$s to %4$s"
 OBSOLETE                     "%1$s: OS proc %2$d maps to package %3$d, CPU %4$d, TPU %5$d"
 OBSOLETE                     "%1$s: OS proc %2$d maps to package %3$d, CPU %4$d"
 OBSOLETE                     "%1$s: HT enabled; %2$d packages; %3$d TPU; %4$d TPUs per package"

Modified: openmp/trunk/runtime/src/kmp.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp.h?rev=231778&r1=231777&r2=231778&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp.h (original)
+++ openmp/trunk/runtime/src/kmp.h Tue Mar 10 04:31:21 2015
@@ -2936,8 +2936,6 @@ extern void __kmp_affinity_set_init_mask
 #if OMP_40_ENABLED
 extern void __kmp_affinity_set_place(int gtid);
 #endif
-extern void __kmp_change_thread_affinity_mask( int gtid, kmp_affin_mask_t *new_mask,
-                                               kmp_affin_mask_t *old_mask );
 extern void __kmp_affinity_determine_capable( const char *env_var );
 extern int __kmp_aux_set_affinity(void **mask);
 extern int __kmp_aux_get_affinity(void **mask);

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=231778&r1=231777&r2=231778&view=diff
==============================================================================
--- openmp/trunk/runtime/src/z_Linux_util.c (original)
+++ openmp/trunk/runtime/src/z_Linux_util.c Tue Mar 10 04:31:21 2015
@@ -499,6 +499,55 @@ __kmp_test_then_and8( volatile kmp_int8
     }
 }
 
+
+/*
+ * Change thread to the affinity mask pointed to by affin_mask argument
+ * and return a pointer to the old value in the old_mask argument, if argument
+ * is non-NULL.
+ */
+
+void
+__kmp_change_thread_affinity_mask( int gtid, kmp_affin_mask_t *new_mask,
+                                   kmp_affin_mask_t *old_mask )
+{
+    KMP_DEBUG_ASSERT( gtid == __kmp_get_gtid() );
+    if ( KMP_AFFINITY_CAPABLE() ) {
+        int status;
+        kmp_info_t  *th = __kmp_threads[ gtid ];
+
+        KMP_DEBUG_ASSERT( new_mask != NULL );
+
+        if ( old_mask != NULL ) {
+            status = __kmp_get_system_affinity( old_mask, TRUE );
+            int error = errno;
+            if ( status != 0 ) {
+                __kmp_msg(
+                    kmp_ms_fatal,
+                    KMP_MSG( ChangeThreadAffMaskError ),
+                    KMP_ERR( error ),
+                    __kmp_msg_null
+                );
+            }
+        }
+
+        __kmp_set_system_affinity( new_mask, TRUE );
+
+        if (__kmp_affinity_verbose) {
+            char old_buf[KMP_AFFIN_MASK_PRINT_LEN];
+            char new_buf[KMP_AFFIN_MASK_PRINT_LEN];
+            __kmp_affinity_print_mask(old_buf, KMP_AFFIN_MASK_PRINT_LEN, old_mask);
+            __kmp_affinity_print_mask(new_buf, KMP_AFFIN_MASK_PRINT_LEN, new_mask);
+            KMP_INFORM( ChangeAffMask, "KMP_AFFINITY (Bind)", gtid, old_buf, new_buf );
+
+        }
+
+        /* Make sure old value is correct in thread data structures */
+        KMP_DEBUG_ASSERT( old_mask != NULL && (memcmp(old_mask,
+          th->th.th_affin_mask, __kmp_affin_mask_size) == 0) );
+        KMP_CPU_COPY( th->th.th_affin_mask, new_mask );
+    }
+}
+
 #endif // KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED
 
 /* ------------------------------------------------------------------------ */

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=231778&r1=231777&r2=231778&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:31:21 2015
@@ -1155,46 +1155,6 @@ __kmp_read_system_time( double *delta )
 /* ------------------------------------------------------------------------ */
 /* ------------------------------------------------------------------------ */
 
-/*
- * Change thread to the affinity mask pointed to by affin_mask argument
- * and return a pointer to the old value in the old_mask argument, if argument
- * is non-NULL.
- */
-
-void
-__kmp_change_thread_affinity_mask( int gtid, kmp_affin_mask_t *new_mask,
-                                   kmp_affin_mask_t *old_mask )
-{
-    kmp_info_t  *th = __kmp_threads[ gtid ];
-
-    KMP_DEBUG_ASSERT( *new_mask != 0 );
-
-    if ( old_mask != NULL ) {
-        *old_mask = SetThreadAffinityMask( th -> th.th_info.ds.ds_thread, *new_mask );
-
-        if (! *old_mask ) {
-            DWORD error = GetLastError();
-            __kmp_msg(
-                kmp_ms_fatal,
-                KMP_MSG( CantSetThreadAffMask ),
-                KMP_ERR( error ),
-                __kmp_msg_null
-            );
-        }
-    }
-    if (__kmp_affinity_verbose)
-            KMP_INFORM( ChangeAffMask, "KMP_AFFINITY (Bind)", gtid, *old_mask, *new_mask );
-
-    /* Make sure old value is correct in thread data structures */
-    KMP_DEBUG_ASSERT( old_mask != NULL && *old_mask == *(th -> th.th_affin_mask ));
-
-    KMP_CPU_COPY(th -> th.th_affin_mask, new_mask);
-}
-
-
-/* ------------------------------------------------------------------------ */
-/* ------------------------------------------------------------------------ */
-
 void * __stdcall
 __kmp_launch_worker( void *arg )
 {





More information about the Openmp-commits mailing list