Commit 4261bd2c authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Removed debugging output to stdout at every time-step. Code formatting.

parent 951e1ae8
......@@ -369,27 +369,39 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
}
#ifdef SWIFT_DEBUG_CHECKS
const float shift_threshold_x = 4. * ci->width[0] * (1. + 2.*space_maxreldx);
const float shift_threshold_y = 4. * ci->width[1] * (1. + 2.*space_maxreldx);
const float shift_threshold_z = 4. * ci->width[2] * (1. + 2.*space_maxreldx);
const float shift_threshold_x =
4. * ci->width[0] * (1. + 2. * space_maxreldx);
const float shift_threshold_y =
4. * ci->width[1] * (1. + 2. * space_maxreldx);
const float shift_threshold_z =
4. * ci->width[2] * (1. + 2. * space_maxreldx);
/* Make sure that particle positions have been shifted correctly. */
for (int i = 0; i < ci_cache_count; i++) {
if (x[i] > shift_threshold_x || x[i] < -shift_threshold_x)
error(
"Error: ci->loc[%lf,%lf,%lf],cj->loc[%lf,%lf,%lf] Particle %d x pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. x=%f, ci->width[0]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, x[i], ci->width[0]);
"Error: ci->loc[%lf,%lf,%lf],cj->loc[%lf,%lf,%lf] Particle %d x pos "
"is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. x=%f, ci->width[0]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, x[i],
ci->width[0]);
if (y[i] > shift_threshold_y || y[i] < -shift_threshold_y)
error(
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d y pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. y=%f, ci->width[1]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, y[i], ci->width[1]);
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d y pos "
"is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. y=%f, ci->width[1]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, y[i],
ci->width[1]);
if (z[i] > shift_threshold_z || z[i] < -shift_threshold_z)
error(
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d z pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. z=%f, ci->width[2]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, z[i], ci->width[2]);
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d z pos "
"is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. z=%f, ci->width[2]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, z[i],
ci->width[2]);
}
#endif
......@@ -438,19 +450,28 @@ __attribute__((always_inline)) INLINE void cache_read_two_partial_cells_sorted(
for (int i = 0; i <= last_pj_align; i++) {
if (xj[i] > shift_threshold_x || xj[i] < -shift_threshold_x)
error(
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d xj pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. xj=%f, ci->width[0]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, xj[i], ci->width[0]);
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d xj "
"pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. xj=%f, ci->width[0]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, xj[i],
ci->width[0]);
if (yj[i] > shift_threshold_y || yj[i] < -shift_threshold_y)
error(
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d yj pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. yj=%f, ci->width[1]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, yj[i], ci->width[1]);
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d yj "
"pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. yj=%f, ci->width[1]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, yj[i],
ci->width[1]);
if (zj[i] > shift_threshold_z || zj[i] < -shift_threshold_z)
error(
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d zj pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + 2*space_maxreldx)]. zj=%f, ci->width[2]=%f", ci->loc[0], ci->loc[1], ci->loc[2],
loc[0], loc[1], loc[2], i, zj[i], ci->width[2]);
"Error: ci->loc[%lf,%lf,%lf], cj->loc[%lf,%lf,%lf] Particle %d zj "
"pos is not within "
"[-4*ci->width*(1 + 2*space_maxreldx), 4*ci->width*(1 + "
"2*space_maxreldx)]. zj=%f, ci->width[2]=%f",
ci->loc[0], ci->loc[1], ci->loc[2], loc[0], loc[1], loc[2], i, zj[i],
ci->width[2]);
}
#endif
......
......@@ -1704,7 +1704,6 @@ void cell_activate_subcell_grav_tasks(struct cell *ci, struct cell *cj,
cj->multipole->CoM_old[2] = cj->multipole->CoM[2];
}
/* Self interaction? */
if (cj == NULL) {
......
......@@ -3656,7 +3656,7 @@ void engine_step(struct engine *e) {
if (e->nodeID == 0) {
/* Print some information to the screen */
printf(" %6d %10lld %3d %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->ti_current, e->max_active_bin, e->time,
printf(" %6d %14e %14e %10zu %10zu %10zu %21.3f\n", e->step, e->time,
e->timeStep, e->updates, e->g_updates, e->s_updates,
e->wallclock_time);
fflush(stdout);
......
......@@ -999,7 +999,8 @@ void runner_dopair_grav(struct runner *r, struct cell *ci, struct cell *cj,
* option... */
/* Can we use M-M interactions ? */
if (gravity_M2L_accept(multi_i->r_max_old, multi_j->r_max_old, theta_crit2, r2)) {
if (gravity_M2L_accept(multi_i->r_max_old, multi_j->r_max_old, theta_crit2,
r2)) {
/* MATTHIEU: make a symmetric M-M interaction function ! */
runner_dopair_grav_mm(r, ci, cj);
......@@ -1169,7 +1170,8 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
/* Recover the local multipole */
struct gravity_tensors *const multi_i = ci->multipole;
const double CoM_i[3] = {multi_i->CoM_old[0], multi_i->CoM_old[1], multi_i->CoM_old[2]};
const double CoM_i[3] = {multi_i->CoM_old[0], multi_i->CoM_old[1],
multi_i->CoM_old[2]};
const double CoM_rebuild_i[3] = {multi_i->CoM_rebuild[0],
multi_i->CoM_rebuild[1],
multi_i->CoM_rebuild[2]};
......@@ -1209,7 +1211,8 @@ void runner_do_grav_long_range(struct runner *r, struct cell *ci, int timer) {
}
/* Check the multipole acceptance criterion */
if (gravity_M2L_accept(multi_i->r_max_old, multi_j->r_max_old, theta_crit2, r2)) {
if (gravity_M2L_accept(multi_i->r_max_old, multi_j->r_max_old, theta_crit2,
r2)) {
/* Go for a (non-symmetric) M-M calculation */
runner_dopair_grav_mm(r, ci, cj);
......
......@@ -285,11 +285,11 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
temp = 0;
const struct part *pi = &parts_i[sort_i[first_pi].i];
const float first_di = sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift;
const float first_di =
sort_i[first_pi].d + pi->h * kernel_gamma + dx_max - rshift;
/* Loop through particles in cell j until they are not in range of pi. */
while (temp < cj->count && first_di > sort_j[temp].d)
temp++;
while (temp < cj->count && first_di > sort_j[temp].d) temp++;
max_index_i[first_pi] = temp;
......@@ -297,11 +297,10 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
for (int i = first_pi + 1; i < ci->count; i++) {
temp = max_index_i[i - 1];
pi = &parts_i[sort_i[i].i];
const float di = sort_i[i].d + pi->h * kernel_gamma + dx_max - rshift;
while (temp < cj->count && di > sort_j[temp].d)
temp++;
while (temp < cj->count && di > sort_j[temp].d) temp++;
max_index_i[i] = temp;
}
......@@ -332,11 +331,11 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
temp = ci->count - 1;
const struct part *pj = &parts_j[sort_j[last_pj].i];
const float last_dj = sort_j[last_pj].d - dx_max - pj->h * kernel_gamma + rshift;
const float last_dj =
sort_j[last_pj].d - dx_max - pj->h * kernel_gamma + rshift;
/* Loop through particles in cell i until they are not in range of pj. */
while (temp > 0 && last_dj < sort_i[temp].d)
temp--;
while (temp > 0 && last_dj < sort_i[temp].d) temp--;
max_index_j[last_pj] = temp;
......@@ -346,8 +345,7 @@ __attribute__((always_inline)) INLINE static void populate_max_index_no_cache(
pj = &parts_j[sort_j[i].i];
const float dj = sort_j[i].d - dx_max - (pj->h * kernel_gamma) + rshift;
while (temp > 0 && dj < sort_i[temp].d)
temp--;
while (temp > 0 && dj < sort_i[temp].d) temp--;
max_index_j[i] = temp;
}
......@@ -1187,9 +1185,8 @@ void runner_dopair1_density_vec(struct runner *r, struct cell *ci,
VEC_HADD(curlvzSum, pj->density.rot_v[2]);
} /* loop over the parts in cj. */
}
TIMER_TOC(timer_dopair_density);
#endif /* WITH_VECTORIZATION */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment