From d29eb4469ee21d353b21897f4ef480f4b72d1752 Mon Sep 17 00:00:00 2001 From: Pedro Gonnet <gonnet@google.com> Date: Thu, 20 Apr 2017 23:57:56 +0200 Subject: [PATCH] do not re-sort when doing subset interactions as cj is not locked. --- src/runner_doiact.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/runner_doiact.h b/src/runner_doiact.h index cf8174e485..8d98a25429 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -461,7 +461,7 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci, struct engine *e = r->e; - error("Don't use in actual runs ! Slow code !"); +// error("Don't use in actual runs ! Slow code !"); #ifdef WITH_OLD_VECTORIZATION int icount = 0; @@ -3165,13 +3165,14 @@ void DOSUB_SUBSET(struct runner *r, struct cell *ci, struct part *parts, : (cj->loc[k] - ci->loc[k] + shift[k] > 0) ? 2 : 1); new_sid = sortlistID[new_sid]; - /* Do any of the cells need to be drifted or sorted first? */ + /* Do any of the cells need to be drifted first? */ if (!cell_is_drifted(cj, e)) cell_drift_particles(cj, e); - if (!(cj->sorted & (1 << new_sid))) - runner_do_sort(r, cj, (1 << new_sid), 1); - /* Compute the interactions. */ - DOPAIR_SUBSET(r, ci, parts, ind, count, cj); + /* If the cell is not sorted, don't re-generate the sort indices. */ + if (!(cj->sorted & (1 << new_sid))) + DOPAIR_SUBSET_NAIVE(r, ci, parts, ind, count, cj); + else + DOPAIR_SUBSET(r, ci, parts, ind, count, cj); } } /* otherwise, pair interaction. */ -- GitLab