[Openmp-commits] [openmp] r245209 - D11988: Force serial reduction when team size is 1

Andrey Churbanov via Openmp-commits openmp-commits at lists.llvm.org
Mon Aug 17 03:12:12 PDT 2015


Author: achurbanov
Date: Mon Aug 17 05:12:12 2015
New Revision: 245209

URL: http://llvm.org/viewvc/llvm-project?rev=245209&view=rev
Log:
D11988: Force serial reduction when team size is 1

Modified:
    openmp/trunk/runtime/src/kmp_runtime.c

Modified: openmp/trunk/runtime/src/kmp_runtime.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/kmp_runtime.c?rev=245209&r1=245208&r2=245209&view=diff
==============================================================================
--- openmp/trunk/runtime/src/kmp_runtime.c (original)
+++ openmp/trunk/runtime/src/kmp_runtime.c Mon Aug 17 05:12:12 2015
@@ -7641,7 +7641,9 @@ __kmp_determine_reduction_method( ident_
 
     // KMP_FORCE_REDUCTION
 
-    if( __kmp_force_reduction_method != reduction_method_not_defined ) {
+    // If the team is serialized (team_size == 1), ignore the forced reduction
+    // method and stay with the unsynchronized method (empty_reduce_block)
+    if( __kmp_force_reduction_method != reduction_method_not_defined && team_size != 1) {
 
         PACKED_REDUCTION_METHOD_T forced_retval;
 
@@ -7651,9 +7653,6 @@ __kmp_determine_reduction_method( ident_
         {
             case critical_reduce_block:
                 KMP_ASSERT( lck );              // lck should be != 0
-                if( team_size <= 1 ) {
-                    forced_retval = empty_reduce_block;
-                }
                 break;
 
             case atomic_reduce_block:




More information about the Openmp-commits mailing list