From 00f39e511f3f47afeff5e45c5d29638edf35954d Mon Sep 17 00:00:00 2001
From: Pedro Gonnet <pedro.gonnet@durham.ac.uk>
Date: Tue, 27 Aug 2013 14:14:37 +0000
Subject: [PATCH] bug in task splitting (too conservative).

Former-commit-id: 4742d869cc1d03ecbb66633fb5ab05269928f16b
---
 src/runner_doiact.h | 6 +++---
 src/scheduler.c     | 4 ++--
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/runner_doiact.h b/src/runner_doiact.h
index 50dea3852d..411ebb7c1c 100644
--- a/src/runner_doiact.h
+++ b/src/runner_doiact.h
@@ -1731,7 +1731,7 @@ void DOSUB1 ( struct runner *r , struct cell *ci , struct cell *cj , int sid , i
             
         /* Recurse? */
         if ( ci->split && cj->split &&
-             fmaxf( ci->h_max , cj->h_max ) + ci->dx_max + cj->dx_max < h ) {
+             fmaxf( ci->h_max , cj->h_max )*kernel_gamma + ci->dx_max + cj->dx_max < h ) {
              
             /* Different types of flags. */
             switch ( sid ) {
@@ -2012,7 +2012,7 @@ void DOSUB2 ( struct runner *r , struct cell *ci , struct cell *cj , int sid , i
     
         /* Recurse? */
         if ( ci->split && cj->split &&
-             fmaxf( ci->h_max , cj->h_max ) + ci->dx_max + cj->dx_max < h ) {
+             fmaxf( ci->h_max , cj->h_max )*kernel_gamma + ci->dx_max + cj->dx_max < h ) {
              
             /* Different types of flags. */
             switch ( sid ) {
@@ -2295,7 +2295,7 @@ void DOSUB_SUBSET ( struct runner *r , struct cell *ci , struct part *parts , in
 
         /* Recurse? */
         if ( ci->split && cj->split &&
-             fmaxf( ci->h_max , cj->h_max ) + ci->dx_max + cj->dx_max < h ) {
+             fmaxf( ci->h_max , cj->h_max )*kernel_gamma + ci->dx_max + cj->dx_max < h ) {
              
             /* Get the type of pair if not specified explicitly. */
             sid = space_getsid( s , &ci , &cj , shift );
diff --git a/src/scheduler.c b/src/scheduler.c
index 62a119ebb9..6a33c5c59d 100644
--- a/src/scheduler.c
+++ b/src/scheduler.c
@@ -282,8 +282,8 @@ void scheduler_splittasks ( struct scheduler *s ) {
                 
             /* Should this task be split-up? */
             if ( ci->split && cj->split &&
-                 ci->h_max*kernel_gamma*space_stretch < hi/2 &&
-                 cj->h_max*kernel_gamma*space_stretch < hj/2 ) {
+                 ci->h_max*kernel_gamma*space_stretch < hi &&
+                 cj->h_max*kernel_gamma*space_stretch < hj ) {
                  
                 /* Replace by a single sub-task? */
                 if ( scheduler_dosub &&
-- 
GitLab