diff --git a/configure.ac b/configure.ac index 9ec78c8b8b8168191df002a01ed5de6fb1580243..5851324ec76a466aa52f0cbecf972cf32d4a256f 100644 --- a/configure.ac +++ b/configure.ac @@ -226,6 +226,18 @@ if test "$enable_debugging_checks" = "yes"; then AC_DEFINE([SWIFT_DEBUG_CHECKS],1,[Enable expensive debugging]) fi +# Check whether we want to default to naive cell interactions +AC_ARG_ENABLE([naive-interactions], + [AS_HELP_STRING([--enable-naive-interactions], + [Activate use of naive cell interaction functions @<:@yes/no@:>@] + )], + [enable_naive_interactions="$enableval"], + [enable_naive_interactions="no"] +) +if test "$enable_naive_interactions" = "yes"; then + AC_DEFINE([SWIFT_USE_NAIVE_INTERACTIONS],1,[Enable use of naive cell interaction functions]) +fi + # Check if gravity force checks are on for some particles. AC_ARG_ENABLE([gravity-force-checks], [AS_HELP_STRING([--enable-gravity-force-checks], @@ -919,6 +931,7 @@ AC_MSG_RESULT([ Task debugging : $enable_task_debugging Threadpool debugging : $enable_threadpool_debugging Debugging checks : $enable_debugging_checks + Naive interactions : $enable_naive_interactions Gravity checks : $gravity_force_checks ------------------------]) diff --git a/examples/main.c b/examples/main.c index 56f463940d51cc1c30904c2472334768fa3d58d1..0d87ea350793e0d089b41d3bd05a68cd97753ef9 100644 --- a/examples/main.c +++ b/examples/main.c @@ -361,6 +361,13 @@ int main(int argc, char *argv[]) { message("WARNING: Debugging checks activated. Code will be slower !"); #endif +/* Do we have debugging checks ? */ +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + if (myrank == 0) + message( + "WARNING: Naive cell interactions activated. Code will be slower !"); +#endif + /* Do we have gravity accuracy checks ? */ #ifdef SWIFT_GRAVITY_FORCE_CHECKS if (myrank == 0) diff --git a/src/runner_doiact.h b/src/runner_doiact.h index cd52702b619843ac11ebc666e91214f65ac8624d..bcbd0b7425747ea5e9cf0bcccb1d653d8b8d8126 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -124,10 +124,6 @@ void DOPAIR1_NAIVE(struct runner *r, struct cell *restrict ci, const struct engine *e = r->e; -#ifndef SWIFT_DEBUG_CHECKS - error("Don't use in actual runs ! Slow code !"); -#endif - TIMER_TIC; /* Anything to do here? */ @@ -216,10 +212,6 @@ void DOPAIR2_NAIVE(struct runner *r, struct cell *restrict ci, const struct engine *e = r->e; -#ifndef SWIFT_DEBUG_CHECKS - error("Don't use in actual runs ! Slow code !"); -#endif - TIMER_TIC; /* Anything to do here? */ @@ -310,10 +302,6 @@ void DOSELF1_NAIVE(struct runner *r, struct cell *restrict c) { const struct engine *e = r->e; -#ifndef SWIFT_DEBUG_CHECKS - error("Don't use in actual runs ! Slow code !"); -#endif - TIMER_TIC; /* Anything to do here? */ @@ -392,10 +380,6 @@ void DOSELF2_NAIVE(struct runner *r, struct cell *restrict c) { const struct engine *e = r->e; -#ifndef SWIFT_DEBUG_CHECKS - error("Don't use in actual runs ! Slow code !"); -#endif - TIMER_TIC; /* Anything to do here? */ @@ -481,10 +465,6 @@ void DOPAIR_SUBSET_NAIVE(struct runner *r, struct cell *restrict ci, const struct engine *e = r->e; -#ifndef SWIFT_DEBUG_CHECKS - error("Don't use in actual runs ! Slow code !"); -#endif - TIMER_TIC; const int count_j = cj->count; @@ -565,6 +545,11 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, const struct engine *e = r->e; +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + DOPAIR_SUBSET_NAIVE(r, ci, parts_i, ind, count, cj); + return; +#endif + TIMER_TIC; const int count_j = cj->count; @@ -777,8 +762,10 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj, const int sid, const struct engine *restrict e = r->e; - // DOPAIR1_NAIVE(r, ci, cj); - // return; +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + DOPAIR1_NAIVE(r, ci, cj); + return; +#endif TIMER_TIC; @@ -999,8 +986,10 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { struct engine *restrict e = r->e; - // DOPAIR2_NAIVE(r, ci, cj); - // return; +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + DOPAIR2_NAIVE(r, ci, cj); + return; +#endif TIMER_TIC; @@ -1337,6 +1326,11 @@ void DOSELF1(struct runner *r, struct cell *restrict c) { const struct engine *e = r->e; +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + DOSELF1_NAIVE(r, c); + return; +#endif + TIMER_TIC; if (!cell_is_active(c, e)) return; @@ -1469,6 +1463,11 @@ void DOSELF2(struct runner *r, struct cell *restrict c) { const struct engine *e = r->e; +#ifdef SWIFT_USE_NAIVE_INTERACTIONS + DOSELF2_NAIVE(r, c); + return; +#endif + TIMER_TIC; if (!cell_is_active(c, e)) return;