diff --git a/src/runner_doiact.h b/src/runner_doiact.h index 1fbaa3398dc7cd839ba1b1bafde1a2372658bbf1..5ce5de6382574ad5ef8317cf23285723a2d4e68f 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -1861,6 +1861,7 @@ void DOSUB_PAIR1(struct runner *r, struct cell *ci, struct cell *cj, int sid, /* Should we even bother? */ if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; + if (ci->count == 0 || cj->count == 0) return; /* Get the cell dimensions. */ const float h = min(ci->width[0], min(ci->width[1], ci->width[2])); @@ -2099,7 +2100,7 @@ void DOSUB_SELF1(struct runner *r, struct cell *ci, int gettimer) { TIMER_TIC; /* Should we even bother? */ - if (!cell_is_active(ci, r->e)) return; + if (ci->count == 0 || !cell_is_active(ci, r->e)) return; #ifdef SWIFT_DEBUG_CHECKS cell_is_drifted(ci, r->e); @@ -2153,6 +2154,7 @@ void DOSUB_PAIR2(struct runner *r, struct cell *ci, struct cell *cj, int sid, /* Should we even bother? */ if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; + if (ci->count == 0 || cj->count == 0) return; /* Get the cell dimensions. */ const float h = min(ci->width[0], min(ci->width[1], ci->width[2])); @@ -2391,7 +2393,7 @@ void DOSUB_SELF2(struct runner *r, struct cell *ci, int gettimer) { TIMER_TIC; /* Should we even bother? */ - if (!cell_is_active(ci, r->e)) return; + if (ci->count == 0 || !cell_is_active(ci, r->e)) return; /* Recurse? */ if (ci->split) { diff --git a/src/scheduler.c b/src/scheduler.c index 9f0f0fd944ebeb1399591214489272d38e150a72..1710cb32a6d912b718e6a69852e118e0731d736d 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -158,10 +158,10 @@ static void scheduler_splittask(struct task *t, struct scheduler *s) { } /* Is this cell even split? */ - if (ci->split && ci->h_max * kernel_gamma * space_stretch < hi / 2) { + if (ci->split && 2.f * kernel_gamma * ci->h_max * space_stretch < hi) { /* Make a sub? */ - if (scheduler_dosub && + if (scheduler_dosub && /* Note division here to avoid overflow */ ((ci->count > 0 && ci->count < space_subsize / ci->count) || (ci->gcount > 0 && ci->gcount < space_subsize / ci->gcount))) { @@ -223,8 +223,8 @@ static void scheduler_splittask(struct task *t, 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) { + 2.f * kernel_gamma * space_stretch * ci->h_max < hi && + 2.f * kernel_gamma * space_stretch * cj->h_max < hj) { /* Replace by a single sub-task? */ if (scheduler_dosub &&