From 640b1dfb4b882c88aecfdb0b2c548099d04425e6 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 27 Jan 2017 14:19:05 +0000 Subject: [PATCH 1/7] Add a check to make sure periodic boundary conditions are correctly applied when rebuilding. --- src/space.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/space.c b/src/space.c index 8d5dc34dc..0bbf17806 100644 --- a/src/space.c +++ b/src/space.c @@ -844,6 +844,13 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, cell_getid(cdim, pos_x * ih_x, pos_y * ih_y, pos_z * ih_z); ind[k] = index; +#ifdef SWIFT_DEBUG_CHECKS + if(pos_x > dim_x || pos_y > dim_y || pos_z > pos_z || + pos_x < 0. || pos_y < 0. || pos_z < 0.) + error("Particle outside of simulation box. p->x=[%e %e %e]", + pos_x, pos_y, pos_z); +#endif + /* Update the position */ p->x[0] = pos_x; p->x[1] = pos_y; -- GitLab From 250c880a9a056b465164617c54b9afa3a3079db8 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Sun, 29 Jan 2017 20:51:28 +0000 Subject: [PATCH 2/7] Do not use sorted pair interactions when the pair interacts over MPI. --- src/runner_doiact.h | 22 ++++ src/runner_doiact_nosort.h | 243 +++++++++++++++++++++++++++++++++++++ 2 files changed, 265 insertions(+) create mode 100644 src/runner_doiact_nosort.h diff --git a/src/runner_doiact.h b/src/runner_doiact.h index e78d87e4b..86965ff1b 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -32,6 +32,12 @@ #define _DOPAIR2(f) PASTE(runner_dopair2, f) #define DOPAIR2 _DOPAIR2(FUNCTION) +#define _DOPAIR1_NOSORT(f) PASTE(runner_dopair1_sort, f) +#define DOPAIR1_NOSORT _DOPAIR1_NOSORT(FUNCTION) + +#define _DOPAIR2_NOSORT(f) PASTE(runner_dopair2_sort, f) +#define DOPAIR2_NOSORT _DOPAIR2_NOSORT(FUNCTION) + #define _DOPAIR_SUBSET(f) PASTE(runner_dopair_subset, f) #define DOPAIR_SUBSET _DOPAIR_SUBSET(FUNCTION) @@ -98,6 +104,8 @@ #define _TIMER_DOPAIR_SUBSET(f) PASTE(timer_dopair_subset, f) #define TIMER_DOPAIR_SUBSET _TIMER_DOPAIR_SUBSET(FUNCTION) +#include "runner_doiact_nosort.h" + /** * @brief Compute the interactions between a cell pair. * @@ -707,6 +715,13 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { const struct engine *restrict e = r->e; +#ifdef WITH_MPI + if(ci->nodeID != cj->nodeID) { + DOPAIR1_NOSORT(r, ci, cj); + return; + } +#endif + #ifdef WITH_VECTORIZATION int icount = 0; float r2q[VEC_SIZE] __attribute__((aligned(16))); @@ -912,6 +927,13 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { struct engine *restrict e = r->e; +#ifdef WITH_MPI + if(ci->nodeID != cj->nodeID) { + DOPAIR2_NOSORT(r, ci, cj); + return; + } +#endif + #ifdef WITH_VECTORIZATION int icount1 = 0; float r2q1[VEC_SIZE] __attribute__((aligned(16))); diff --git a/src/runner_doiact_nosort.h b/src/runner_doiact_nosort.h new file mode 100644 index 000000000..f2fa71915 --- /dev/null +++ b/src/runner_doiact_nosort.h @@ -0,0 +1,243 @@ + +/** + * @brief Compute the interactions between a cell pair. + * + * @param r The #runner. + * @param ci The first #cell. + * @param cj The second #cell. + */ +void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, + struct cell *cj) { + + const struct engine *e = r->e; + + TIMER_TIC; + + /* Anything to do here? */ + if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; + + if (!cell_is_drifted(ci, e)) cell_drift(ci, e); + if (!cell_is_drifted(cj, e)) cell_drift(cj, e); + + const int count_i = ci->count; + const int count_j = cj->count; + struct part *restrict parts_i = ci->parts; + struct part *restrict parts_j = cj->parts; + + /* Get the relative distance between the pairs, wrapping. */ + double shift[3] = {0.0, 0.0, 0.0}; + space_getsid(e->s, &ci, &cj, shift); + + /* Loop over the parts in ci. */ + for (int pid = 0; pid < count_i; pid++) { + + /* Get a hold of the ith part in ci. */ + struct part *restrict pi = &parts_i[pid]; + if (!part_is_active(pi, e)) continue; + const float hi = pi->h; + + double pix[3]; + for (int k = 0; k < 3; k++) pix[k] = pi->x[k] - shift[k]; + const float hig2 = hi * hi * kernel_gamma2; + + /* Loop over the parts in cj. */ + for (int pjd = 0; pjd < count_j; pjd++) { + + /* Get a pointer to the jth particle. */ + struct part *restrict pj = &parts_j[pjd]; + + /* Compute the pairwise distance. */ + float r2 = 0.0f; + float dx[3]; + for (int k = 0; k < 3; k++) { + dx[k] = pix[k] - pj->x[k]; + r2 += dx[k] * dx[k]; + } + +#ifdef SWIFT_DEBUG_CHECKS + /* Check that particles have been drifted to the current time */ + if (pi->ti_drift != e->ti_current) + error("Particle pi not drifted to current time"); + if (pj->ti_drift != e->ti_current) + error("Particle pj not drifted to current time"); +#endif + + /* Hit or miss? */ + if (r2 < hig2) { + IACT_NONSYM(r2, dx, hi, pj->h, pi, pj); + } + + } /* loop over the parts in cj. */ + + } /* loop over the parts in ci. */ + + + /* Loop over the parts in cj. */ + for (int pjd = 0; pjd < count_j; pjd++) { + + /* Get a hold of the ith part in ci. */ + struct part *restrict pj = &parts_j[pjd]; + if (!part_is_active(pj, e)) continue; + const float hj = pj->h; + + double pjx[3]; + for (int k = 0; k < 3; k++) pjx[k] = pj->x[k] + shift[k]; + const float hjg2 = hj * hj * kernel_gamma2; + + /* Loop over the parts in ci. */ + for (int pid = 0; pid < count_i; pid++) { + + /* Get a pointer to the jth particle. */ + struct part *restrict pi = &parts_i[pid]; + + /* Compute the pairwise distance. */ + float r2 = 0.0f; + float dx[3]; + for (int k = 0; k < 3; k++) { + dx[k] = pjx[k] - pi->x[k]; + r2 += dx[k] * dx[k]; + } + +#ifdef SWIFT_DEBUG_CHECKS + /* Check that particles have been drifted to the current time */ + if (pj->ti_drift != e->ti_current) + error("Particle pj not drifted to current time"); + if (pi->ti_drift != e->ti_current) + error("Particle pi not drifted to current time"); +#endif + + /* Hit or miss? */ + if (r2 < hjg2) { + IACT_NONSYM(r2, dx, hj, pi->h, pj, pi); + } + + } /* loop over the parts in ci. */ + + } /* loop over the parts in cj. */ + + + TIMER_TOC(TIMER_DOPAIR); +} + + +/** + * @brief Compute the interactions between a cell pair. + * + * @param r The #runner. + * @param ci The first #cell. + * @param cj The second #cell. + */ +void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, + struct cell *cj) { + + const struct engine *e = r->e; + + TIMER_TIC; + + /* Anything to do here? */ + if (!cell_is_active(ci, e) && !cell_is_active(cj, e)) return; + + if (!cell_is_drifted(ci, e)) cell_drift(ci, e); + if (!cell_is_drifted(cj, e)) cell_drift(cj, e); + + const int count_i = ci->count; + const int count_j = cj->count; + struct part *restrict parts_i = ci->parts; + struct part *restrict parts_j = cj->parts; + + /* Get the relative distance between the pairs, wrapping. */ + double shift[3] = {0.0, 0.0, 0.0}; + space_getsid(e->s, &ci, &cj, shift); + + /* Loop over the parts in ci. */ + for (int pid = 0; pid < count_i; pid++) { + + /* Get a hold of the ith part in ci. */ + struct part *restrict pi = &parts_i[pid]; + if (!part_is_active(pi, e)) continue; + const float hi = pi->h; + + double pix[3]; + for (int k = 0; k < 3; k++) pix[k] = pi->x[k] - shift[k]; + const float hig2 = hi * hi * kernel_gamma2; + + /* Loop over the parts in cj. */ + for (int pjd = 0; pjd < count_j; pjd++) { + + /* Get a pointer to the jth particle. */ + struct part *restrict pj = &parts_j[pjd]; + const float hjg2 = pj->h * pj->h * kernel_gamma2; + + /* Compute the pairwise distance. */ + float r2 = 0.0f; + float dx[3]; + for (int k = 0; k < 3; k++) { + dx[k] = pix[k] - pj->x[k]; + r2 += dx[k] * dx[k]; + } + +#ifdef SWIFT_DEBUG_CHECKS + /* Check that particles have been drifted to the current time */ + if (pi->ti_drift != e->ti_current) + error("Particle pi not drifted to current time"); + if (pj->ti_drift != e->ti_current) + error("Particle pj not drifted to current time"); +#endif + + /* Hit or miss? */ + if (r2 < hig2 || r2 < hjg2) { + IACT_NONSYM(r2, dx, hi, pj->h, pi, pj); + } + + } /* loop over the parts in cj. */ + + } /* loop over the parts in ci. */ + + + /* Loop over the parts in cj. */ + for (int pjd = 0; pjd < count_j; pjd++) { + + /* Get a hold of the ith part in ci. */ + struct part *restrict pj = &parts_j[pjd]; + if (!part_is_active(pj, e)) continue; + const float hj = pj->h; + + double pjx[3]; + for (int k = 0; k < 3; k++) pjx[k] = pj->x[k] + shift[k]; + const float hjg2 = hj * hj * kernel_gamma2; + + /* Loop over the parts in ci. */ + for (int pid = 0; pid < count_i; pid++) { + + /* Get a pointer to the jth particle. */ + struct part *restrict pi = &parts_i[pid]; + const float hig2 = pi->h * pi->h * kernel_gamma2; + + /* Compute the pairwise distance. */ + float r2 = 0.0f; + float dx[3]; + for (int k = 0; k < 3; k++) { + dx[k] = pjx[k] - pi->x[k]; + r2 += dx[k] * dx[k]; + } + +#ifdef SWIFT_DEBUG_CHECKS + /* Check that particles have been drifted to the current time */ + if (pj->ti_drift != e->ti_current) + error("Particle pj not drifted to current time"); + if (pi->ti_drift != e->ti_current) + error("Particle pi not drifted to current time"); +#endif + + /* Hit or miss? */ + if (r2 < hjg2 || r2 < hig2) { + IACT_NONSYM(r2, dx, hj, pi->h, pj, pi); + } + + } /* loop over the parts in ci. */ + + } /* loop over the parts in cj. */ + + + TIMER_TOC(TIMER_DOPAIR); +} -- GitLab From 89064d19dd98197722a25ac71284e0aa3ae59a58 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 3 Feb 2017 12:45:01 +0000 Subject: [PATCH 3/7] Post-merge fix --- src/runner_doiact.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/runner_doiact.h b/src/runner_doiact.h index e9997041f..18ca7663f 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -722,7 +722,6 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { } #endif -#ifdef WITH_VECTORIZATION #ifdef WITH_OLD_VECTORIZATION int icount = 0; float r2q[VEC_SIZE] __attribute__((aligned(16))); @@ -935,7 +934,6 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { } #endif -#ifdef WITH_VECTORIZATION #ifdef WITH_OLD_VECTORIZATION int icount1 = 0; float r2q1[VEC_SIZE] __attribute__((aligned(16))); -- GitLab From 4be976aeff10a031a6af3a92219dad0fbd7c9f2f Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 3 Feb 2017 17:02:17 +0000 Subject: [PATCH 4/7] Also use a non-sorted pair interaction when re-doing a subset of the particles in the ghost. --- src/runner_doiact.h | 14 ++++++-- src/runner_doiact_nosort.h | 73 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 85 insertions(+), 2 deletions(-) diff --git a/src/runner_doiact.h b/src/runner_doiact.h index 18ca7663f..2b53e8b4b 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -32,15 +32,18 @@ #define _DOPAIR2(f) PASTE(runner_dopair2, f) #define DOPAIR2 _DOPAIR2(FUNCTION) -#define _DOPAIR1_NOSORT(f) PASTE(runner_dopair1_sort, f) +#define _DOPAIR1_NOSORT(f) PASTE(runner_dopair1_nosort, f) #define DOPAIR1_NOSORT _DOPAIR1_NOSORT(FUNCTION) -#define _DOPAIR2_NOSORT(f) PASTE(runner_dopair2_sort, f) +#define _DOPAIR2_NOSORT(f) PASTE(runner_dopair2_nosort, f) #define DOPAIR2_NOSORT _DOPAIR2_NOSORT(FUNCTION) #define _DOPAIR_SUBSET(f) PASTE(runner_dopair_subset, f) #define DOPAIR_SUBSET _DOPAIR_SUBSET(FUNCTION) +#define _DOPAIR_SUBSET_NOSORT(f) PASTE(runner_dopair_subset_nosort, f) +#define DOPAIR_SUBSET_NOSORT _DOPAIR_SUBSET_NOSORT(FUNCTION) + #define _DOPAIR_SUBSET_NAIVE(f) PASTE(runner_dopair_subset_naive, f) #define DOPAIR_SUBSET_NAIVE _DOPAIR_SUBSET_NAIVE(FUNCTION) @@ -430,6 +433,13 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, struct engine *e = r->e; +#ifdef WITH_MPI + if(ci->nodeID != cj->nodeID) { + DOPAIR_SUBSET_NOSORT(r, ci, parts_i, ind, count, cj); + return; + } +#endif + #ifdef WITH_OLD_VECTORIZATION int icount = 0; float r2q[VEC_SIZE] __attribute__((aligned(16))); diff --git a/src/runner_doiact_nosort.h b/src/runner_doiact_nosort.h index f2fa71915..e09388283 100644 --- a/src/runner_doiact_nosort.h +++ b/src/runner_doiact_nosort.h @@ -241,3 +241,76 @@ void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, TIMER_TOC(TIMER_DOPAIR); } + + +/** + * @brief Compute the interactions between a cell pair, but only for the + * given indices in ci. + * + * @param r The #runner. + * @param ci The first #cell. + * @param parts_i The #part to interact with @c cj. + * @param ind The list of indices of particles in @c ci to interact with. + * @param count The number of particles in @c ind. + * @param cj The second #cell. + */ +void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci, + struct part *restrict parts_i, int *restrict ind, int count, + struct cell *restrict cj) { + + struct engine *e = r->e; + + + TIMER_TIC; + + const int count_j = cj->count; + struct part *restrict parts_j = cj->parts; + + /* Get the relative distance between the pairs, wrapping. */ + double shift[3] = {0.0, 0.0, 0.0}; + for (int k = 0; k < 3; k++) { + if (cj->loc[k] - ci->loc[k] < -e->s->dim[k] / 2) + shift[k] = e->s->dim[k]; + else if (cj->loc[k] - ci->loc[k] > e->s->dim[k] / 2) + shift[k] = -e->s->dim[k]; + } + + + /* Loop over the parts_i. */ + for (int pid = 0; pid < count; pid++) { + + /* Get a hold of the ith part in ci. */ + struct part *restrict pi = &parts_i[ind[pid]]; + double pix[3]; + for (int k = 0; k < 3; k++) pix[k] = pi->x[k] - shift[k]; + const float hi = pi->h; + const float hig2 = hi * hi * kernel_gamma2; + + if (!part_is_active(pi, e)) + error("Trying to correct smoothing length of inactive particle !"); + + /* Loop over the parts in cj. */ + for (int pjd = 0; pjd < count_j; pjd++) { + + /* Get a pointer to the jth particle. */ + struct part *restrict pj = &parts_j[pjd]; + + /* Compute the pairwise distance. */ + float r2 = 0.0f; + float dx[3]; + for (int k = 0; k < 3; k++) { + dx[k] = pix[k] - pj->x[k]; + r2 += dx[k] * dx[k]; + } + + /* Hit or miss? */ + if (r2 < hig2) { + + IACT_NONSYM(r2, dx, hi, pj->h, pi, pj); + + } + } /* loop over the parts in cj. */ + } /* loop over the parts in ci. */ + + TIMER_TOC(timer_dopair_subset); +} -- GitLab From c6e69ed6b850acf44285796729a17482d83ed5f5 Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 3 Feb 2017 18:23:12 +0000 Subject: [PATCH 5/7] Reduced verbosity when running over MPI. --- src/space.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/space.c b/src/space.c index 0bbf17806..9613d0573 100644 --- a/src/space.c +++ b/src/space.c @@ -472,7 +472,7 @@ void space_rebuild(struct space *s, int verbose) { /* Be verbose about this. */ #ifdef SWIFT_DEBUG_CHECKS - message("re)building space"); + if(s->e->nodeID == 0 || verbose) message("re)building space"); fflush(stdout); #endif @@ -1014,7 +1014,7 @@ void space_parts_sort(struct space *s, int *ind, size_t N, int min, int max, if (ind[i - 1] > ind[i]) error("Sorting failed (ind[%zu]=%i,ind[%zu]=%i), min=%i, max=%i.", i - 1, ind[i - 1], i, ind[i], min, max); - message("Sorting succeeded."); + if(s->e->nodeID == 0 || verbose) message("Sorting succeeded."); #endif /* Clean up. */ @@ -1192,7 +1192,7 @@ void space_gparts_sort(struct space *s, int *ind, size_t N, int min, int max, if (ind[i - 1] > ind[i]) error("Sorting failed (ind[%zu]=%i,ind[%zu]=%i), min=%i, max=%i.", i - 1, ind[i - 1], i, ind[i], min, max); - message("Sorting succeeded."); + if(s->e->nodeID == 0 || verbose) message("Sorting succeeded."); #endif /* Clean up. */ -- GitLab From f8cb871569b3aa551db93ba123d04be77bbe103e Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Fri, 3 Feb 2017 22:45:26 +0000 Subject: [PATCH 6/7] Added new interaction file to the Makefile. --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 5982be729..5434241c0 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -59,7 +59,7 @@ AM_SOURCES = space.c runner.c queue.c task.c cell.c engine.c \ # Include files for distribution, not installation. nobase_noinst_HEADERS = align.h approx_math.h atomic.h cycle.h error.h inline.h kernel_hydro.h kernel_gravity.h \ kernel_long_gravity.h vector.h cache.h runner_doiact.h runner_doiact_vec.h runner_doiact_grav.h runner_doiact_fft.h \ - units.h intrinsics.h minmax.h kick.h timestep.h drift.h adiabatic_index.h io_properties.h \ + runner_doiact_nosort.h units.h intrinsics.h minmax.h kick.h timestep.h drift.h adiabatic_index.h io_properties.h \ dimension.h equation_of_state.h \ gravity.h gravity_io.h \ gravity/Default/gravity.h gravity/Default/gravity_iact.h gravity/Default/gravity_io.h \ -- GitLab From 600f9e92e5b5ed4730a620cce70827f388a7c51c Mon Sep 17 00:00:00 2001 From: Matthieu Schaller Date: Sun, 5 Feb 2017 16:48:31 +0000 Subject: [PATCH 7/7] Code formatting --- src/runner_doiact.h | 6 +++--- src/runner_doiact_nosort.h | 23 ++++++----------------- src/space.c | 14 +++++++------- 3 files changed, 16 insertions(+), 27 deletions(-) diff --git a/src/runner_doiact.h b/src/runner_doiact.h index 2b53e8b4b..6fa040180 100644 --- a/src/runner_doiact.h +++ b/src/runner_doiact.h @@ -434,7 +434,7 @@ void DOPAIR_SUBSET(struct runner *r, struct cell *restrict ci, struct engine *e = r->e; #ifdef WITH_MPI - if(ci->nodeID != cj->nodeID) { + if (ci->nodeID != cj->nodeID) { DOPAIR_SUBSET_NOSORT(r, ci, parts_i, ind, count, cj); return; } @@ -726,7 +726,7 @@ void DOPAIR1(struct runner *r, struct cell *ci, struct cell *cj) { const struct engine *restrict e = r->e; #ifdef WITH_MPI - if(ci->nodeID != cj->nodeID) { + if (ci->nodeID != cj->nodeID) { DOPAIR1_NOSORT(r, ci, cj); return; } @@ -938,7 +938,7 @@ void DOPAIR2(struct runner *r, struct cell *ci, struct cell *cj) { struct engine *restrict e = r->e; #ifdef WITH_MPI - if(ci->nodeID != cj->nodeID) { + if (ci->nodeID != cj->nodeID) { DOPAIR2_NOSORT(r, ci, cj); return; } diff --git a/src/runner_doiact_nosort.h b/src/runner_doiact_nosort.h index e09388283..057dd756b 100644 --- a/src/runner_doiact_nosort.h +++ b/src/runner_doiact_nosort.h @@ -6,8 +6,7 @@ * @param ci The first #cell. * @param cj The second #cell. */ -void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, - struct cell *cj) { +void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, struct cell *cj) { const struct engine *e = r->e; @@ -71,7 +70,6 @@ void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, } /* loop over the parts in ci. */ - /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j; pjd++) { @@ -115,11 +113,9 @@ void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, } /* loop over the parts in cj. */ - TIMER_TOC(TIMER_DOPAIR); } - /** * @brief Compute the interactions between a cell pair. * @@ -127,8 +123,7 @@ void DOPAIR1_NOSORT(struct runner *r, struct cell *ci, * @param ci The first #cell. * @param cj The second #cell. */ -void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, - struct cell *cj) { +void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, struct cell *cj) { const struct engine *e = r->e; @@ -193,7 +188,6 @@ void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, } /* loop over the parts in ci. */ - /* Loop over the parts in cj. */ for (int pjd = 0; pjd < count_j; pjd++) { @@ -238,11 +232,9 @@ void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, } /* loop over the parts in cj. */ - TIMER_TOC(TIMER_DOPAIR); } - /** * @brief Compute the interactions between a cell pair, but only for the * given indices in ci. @@ -255,12 +247,11 @@ void DOPAIR2_NOSORT(struct runner *r, struct cell *ci, * @param cj The second #cell. */ void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci, - struct part *restrict parts_i, int *restrict ind, int count, - struct cell *restrict cj) { + struct part *restrict parts_i, int *restrict ind, + int count, struct cell *restrict cj) { struct engine *e = r->e; - TIMER_TIC; const int count_j = cj->count; @@ -275,7 +266,6 @@ void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci, shift[k] = -e->s->dim[k]; } - /* Loop over the parts_i. */ for (int pid = 0; pid < count; pid++) { @@ -286,7 +276,7 @@ void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci, const float hi = pi->h; const float hig2 = hi * hi * kernel_gamma2; - if (!part_is_active(pi, e)) + if (!part_is_active(pi, e)) error("Trying to correct smoothing length of inactive particle !"); /* Loop over the parts in cj. */ @@ -307,10 +297,9 @@ void DOPAIR_SUBSET_NOSORT(struct runner *r, struct cell *restrict ci, if (r2 < hig2) { IACT_NONSYM(r2, dx, hi, pj->h, pi, pj); - } } /* loop over the parts in cj. */ - } /* loop over the parts in ci. */ + } /* loop over the parts in ci. */ TIMER_TOC(timer_dopair_subset); } diff --git a/src/space.c b/src/space.c index 9613d0573..fa707f41d 100644 --- a/src/space.c +++ b/src/space.c @@ -472,7 +472,7 @@ void space_rebuild(struct space *s, int verbose) { /* Be verbose about this. */ #ifdef SWIFT_DEBUG_CHECKS - if(s->e->nodeID == 0 || verbose) message("re)building space"); + if (s->e->nodeID == 0 || verbose) message("re)building space"); fflush(stdout); #endif @@ -845,10 +845,10 @@ void space_parts_get_cell_index_mapper(void *map_data, int nr_parts, ind[k] = index; #ifdef SWIFT_DEBUG_CHECKS - if(pos_x > dim_x || pos_y > dim_y || pos_z > pos_z || - pos_x < 0. || pos_y < 0. || pos_z < 0.) - error("Particle outside of simulation box. p->x=[%e %e %e]", - pos_x, pos_y, pos_z); + if (pos_x > dim_x || pos_y > dim_y || pos_z > pos_z || pos_x < 0. || + pos_y < 0. || pos_z < 0.) + error("Particle outside of simulation box. p->x=[%e %e %e]", pos_x, pos_y, + pos_z); #endif /* Update the position */ @@ -1014,7 +1014,7 @@ void space_parts_sort(struct space *s, int *ind, size_t N, int min, int max, if (ind[i - 1] > ind[i]) error("Sorting failed (ind[%zu]=%i,ind[%zu]=%i), min=%i, max=%i.", i - 1, ind[i - 1], i, ind[i], min, max); - if(s->e->nodeID == 0 || verbose) message("Sorting succeeded."); + if (s->e->nodeID == 0 || verbose) message("Sorting succeeded."); #endif /* Clean up. */ @@ -1192,7 +1192,7 @@ void space_gparts_sort(struct space *s, int *ind, size_t N, int min, int max, if (ind[i - 1] > ind[i]) error("Sorting failed (ind[%zu]=%i,ind[%zu]=%i), min=%i, max=%i.", i - 1, ind[i - 1], i, ind[i], min, max); - if(s->e->nodeID == 0 || verbose) message("Sorting succeeded."); + if (s->e->nodeID == 0 || verbose) message("Sorting succeeded."); #endif /* Clean up. */ -- GitLab