Skip to content
Snippets Groups Projects
Commit 3012917c authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

make engine_marktasks_mapper work the same as cell_unskip_tasks.

parent 7a4714cf
No related branches found
No related tags found
1 merge request!327Rebuild criteria
......@@ -2075,9 +2075,7 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* Too much particle movement? */
if (t->tight &&
(max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin ||
ci->dx_max > space_maxreldx * ci->h_max ||
cj->dx_max > space_maxreldx * cj->h_max))
max(ci->h_max, cj->h_max) + ci->dx_max + cj->dx_max > cj->dmin)
*rebuild_space = 1;
/* Set this task's skip, otherwise nothing to do. */
......@@ -2089,22 +2087,37 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
/* If this is not a density task, we don't have to do any of the below. */
if (t->subtype != task_subtype_density) continue;
/* Set the sort flags. */
/* Set the correct sorting flags */
if (t->type == task_type_pair) {
if (ci->dx_max_sort > space_maxreldx * ci->dmin) ci->sorted = 0;
if (cj->dx_max_sort > space_maxreldx * cj->dmin) cj->sorted = 0;
if (ci->dx_max_sort > space_maxreldx * ci->dmin) {
for (struct cell *finger = ci; finger != NULL;
finger = finger->parent)
finger->sorted = 0;
}
if (cj->dx_max_sort > space_maxreldx * cj->dmin) {
for (struct cell *finger = cj; finger != NULL;
finger = finger->parent)
finger->sorted = 0;
}
if (!(ci->sorted & (1 << t->flags))) {
atomic_or(&ci->sorts->flags, (1 << t->flags));
#ifdef SWIFT_DEBUG_CHECKS
if (!(ci->sorts->flags & (1 << t->flags)))
error("bad flags in sort task.");
#endif
scheduler_activate(s, ci->sorts);
scheduler_activate(s, ci->super->drift);
}
if (!(cj->sorted & (1 << t->flags))) {
atomic_or(&cj->sorts->flags, (1 << t->flags));
#ifdef SWIFT_DEBUG_CHECKS
if (!(cj->sorts->flags & (1 << t->flags)))
error("bad flags in sort task.");
#endif
scheduler_activate(s, cj->sorts);
scheduler_activate(s, cj->super->drift);
}
}
#ifdef WITH_MPI
/* Activate the send/recv flags. */
if (ci->nodeID != engine_rank) {
......@@ -2177,8 +2190,14 @@ void engine_marktasks_mapper(void *map_data, int num_elements,
if (l == NULL) error("Missing link to send_ti task.");
scheduler_activate(s, l->t);
}
}
} else {
scheduler_activate(s, ci->super->drift);
scheduler_activate(s, cj->super->drift);
}
#else
scheduler_activate(s, ci->super->drift);
scheduler_activate(s, cj->super->drift);
#endif
}
......
......@@ -336,10 +336,8 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
struct part *parts = c->parts;
struct xpart *xparts = c->xparts;
struct entry *sort;
int j, k, count = c->count;
int i, ind, off[8], inds[8], temp_i, missing;
const int count = c->count;
float buff[8];
double px[3];
TIMER_TIC
......@@ -387,6 +385,7 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
if (!(flags & (1 << j))) continue;
/* Init the particle index offsets. */
int off[8];
off[0] = 0;
for (int k = 1; k < 8; k++)
if (c->progeny[k - 1] != NULL)
......@@ -395,6 +394,7 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
off[k] = off[k - 1];
/* Init the entries and indices. */
int inds[8];
for (int k = 0; k < 8; k++) {
inds[k] = k;
if (c->progeny[k] != NULL && c->progeny[k]->count > 0) {
......@@ -409,7 +409,7 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
for (int i = 0; i < 7; i++)
for (int k = i + 1; k < 8; k++)
if (buff[inds[k]] < buff[inds[i]]) {
temp_i = inds[i];
int temp_i = inds[i];
inds[i] = inds[k];
inds[k] = temp_i;
}
......@@ -428,7 +428,7 @@ void runner_do_sort(struct runner *r, struct cell *c, int flags, int clock) {
/* Find the smallest entry. */
for (int k = 1; k < 8 && buff[inds[k]] < buff[inds[k - 1]]; k++) {
temp_i = inds[k - 1];
int temp_i = inds[k - 1];
inds[k - 1] = inds[k];
inds[k] = temp_i;
}
......@@ -1416,7 +1416,8 @@ void *runner_main(void *data) {
} else if (cj == NULL) { /* self */
if (!cell_is_active(ci, e) && t->type != task_type_sort &&
t->type != task_type_send && t->type != task_type_recv)
t->type != task_type_drift && t->type != task_type_send &&
t->type != task_type_recv)
error(
"Task (type='%s/%s') should have been skipped ti_current=%lld "
"c->ti_end_min=%lld",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment