Commit f89460ea authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

More debugging info

parent ab72a00c
......@@ -906,6 +906,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
;
if (l == NULL) error("Missing link to send_xv task.");
scheduler_activate(s, l->t);
if(l->t->cj->drift != NULL) scheduler_activate(s, l->t->cj->drift);
for (l = cj->send_rho; l != NULL && l->t->cj->nodeID != ci->nodeID;
l = l->next)
......@@ -932,6 +933,7 @@ int cell_unskip_tasks(struct cell *c, struct scheduler *s) {
;
if (l == NULL) error("Missing link to send_xv task.");
scheduler_activate(s, l->t);
if(l->t->ci->drift != NULL) scheduler_activate(s, l->t->ci->drift);
for (l = ci->send_rho; l != NULL && l->t->cj->nodeID != cj->nodeID;
l = l->next)
......@@ -1021,7 +1023,7 @@ void cell_drift(struct cell *c, const struct engine *e) {
h_max = max(h_max, cp->h_max);
}
} else if (ti_current >= ti_old) {
} else if (ti_current > ti_old) {
/* Loop over all the g-particles in the cell */
const size_t nr_gparts = c->gcount;
......@@ -1051,6 +1053,8 @@ void cell_drift(struct cell *c, const struct engine *e) {
/* Drift... */
drift_part(p, xp, dt, timeBase, ti_old, ti_current);
p->ti_old = ti_current;
/* Compute (square of) motion since last cell construction */
const float dx2 = xp->x_diff[0] * xp->x_diff[0] +
xp->x_diff[1] * xp->x_diff[1] +
......
......@@ -2066,6 +2066,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
;
if (l == NULL) error("Missing link to send_xv task.");
scheduler_activate(s, l->t);
if(l->t->cj->drift) scheduler_activate(s, l->t->cj->drift);
for (l = cj->send_rho; l != NULL && l->t->cj->nodeID != ci->nodeID;
l = l->next)
......@@ -2093,6 +2094,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
;
if (l == NULL) error("Missing link to send_xv task.");
scheduler_activate(s, l->t);
if(l->t->ci->drift != NULL) scheduler_activate(s, l->t->ci->drift);
for (l = ci->send_rho; l != NULL && l->t->cj->nodeID != cj->nodeID;
l = l->next)
......
......@@ -212,6 +212,7 @@ __attribute__((always_inline)) INLINE static float hydro_compute_timestep(
__attribute__((always_inline)) INLINE static void hydro_first_init_part(
struct part *restrict p, struct xpart *restrict xp) {
p->ti_old = 0;
p->ti_begin = 0;
p->ti_end = 0;
xp->v_full[0] = p->v[0];
......
......@@ -71,6 +71,8 @@ struct part {
/* Particle time of end of time-step. */
int ti_end;
int ti_old;
/* Particle density. */
float rho;
......
......@@ -973,6 +973,8 @@ void runner_do_recv_cell(struct runner *r, struct cell *c, int timer) {
for (size_t k = 0; k < nr_parts; k++) {
const int ti_end = parts[k].ti_end;
// if(ti_end < ti_current) error("Received invalid particle !");
if(parts[k].ti_old != ti_current) error("Received undrifted particles p->ti_old=%d ti_current=%d c->nodeID=%d loc=(%f %f %f) c->drift=%p, c->drift->skip=%d",
parts[k].ti_old, ti_current, c->nodeID, c->loc[0], c->loc[1], c->loc[2], c->drift, c->drift ? c->drift->skip : -1);
ti_end_min = min(ti_end_min, ti_end);
ti_end_max = max(ti_end_max, ti_end);
h_max = max(h_max, parts[k].h);
......@@ -1007,6 +1009,24 @@ void runner_do_recv_cell(struct runner *r, struct cell *c, int timer) {
if (timer) TIMER_TOC(timer_dorecv_cell);
}
void runner_check_drift(struct runner *r, struct cell *c) {
const struct part *restrict parts = c->parts;
const size_t nr_parts = c->count;
const int ti_current = r->e->ti_current;
for (size_t k = 0; k < nr_parts; k++) {
if(parts[k].ti_old != ti_current) {
message("Sending undrifted particles p->ti_old=%d ti_current=%d c->nodeID=%d loc=(%f %f %f) c->drift=%p, c->drift->skip=%d",
parts[k].ti_old, ti_current, c->nodeID, c->loc[0], c->loc[1], c->loc[2],
c->drift, c->drift ? c->drift->skip : -1);
break;
}
}
}
/**
* @brief The #runner main thread routine.
*
......@@ -1170,6 +1190,7 @@ void *runner_main(void *data) {
break;
#ifdef WITH_MPI
case task_type_send:
runner_check_drift(r, ci);
if (t->subtype == task_subtype_tend) {
free(t->buff);
}
......
Supports Markdown
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