diff --git a/src/const.h b/src/const.h index 740122547fe38372e33219735115edec11b6c413..d7a0cb1921bbfcf57f66a386f4c730a1811975ba 100644 --- a/src/const.h +++ b/src/const.h @@ -108,6 +108,6 @@ //#define COOLING_GRACKLE /* Are we debugging ? */ -//#define SWIFT_DEBUG_CHECKS +#define SWIFT_DEBUG_CHECKS #endif /* SWIFT_CONST_H */ diff --git a/src/scheduler.c b/src/scheduler.c index 676b561722fde40ad41332bb997502abd2970042..63878040d7c62f71fd7ea0aa94ce6ec642e6ddff 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -42,6 +42,7 @@ #include "atomic.h" #include "const.h" #include "cycle.h" +#include "engine.h" #include "error.h" #include "intrinsics.h" #include "kernel_hydro.h" @@ -1046,42 +1047,46 @@ void scheduler_start(struct scheduler *s) { #ifdef SWIFT_DEBUG_CHECKS const int ti_current = s->space->e->ti_current; - for (int k = 0; k < s->nr_tasks; k++) { - struct task *t = &s->tasks[k]; - struct cell *ci = t->ci; - struct cell *cj = t->cj; - - if (cj == NULL) { /* self */ - - if (ci->ti_end_min == ti_current && t->skip && t->type != task_type_sort) - error( - "Task (type='%s/%s') should not have been skipped ti_current=%d " - "c->ti_end_min=%d", - taskID_names[t->type], subtaskID_names[t->subtype], ti_current, - ci->ti_end_min); - - /* Special treatment for sort tasks */ - if (ci->ti_end_min == ti_current && t->skip && - t->type == task_type_sort && t->flags == 0) - error( - "Task (type='%s/%s') should not have been skipped ti_current=%d " - "c->ti_end_min=%d t->flags=%d", - taskID_names[t->type], subtaskID_names[t->subtype], ti_current, - ci->ti_end_min, t->flags); - - } else { /* pair */ - - if ((ci->ti_end_min == ti_current || cj->ti_end_min == ti_current) && - t->skip) - error( - "Task (type='%s/%s') should not have been skipped ti_current=%d " - "ci->ti_end_min=%d cj->ti_end_min=%d", - taskID_names[t->type], subtaskID_names[t->subtype], ti_current, - ci->ti_end_min, cj->ti_end_min); + if (ti_current > 0) { + + for (int k = 0; k < s->nr_tasks; k++) { + + struct task *t = &s->tasks[k]; + struct cell *ci = t->ci; + struct cell *cj = t->cj; + + if (cj == NULL) { /* self */ + + if (ci->ti_end_min == ti_current && t->skip && + t->type != task_type_sort) + error( + "Task (type='%s/%s') should not have been skipped ti_current=%d " + "c->ti_end_min=%d", + taskID_names[t->type], subtaskID_names[t->subtype], ti_current, + ci->ti_end_min); + + /* Special treatment for sort tasks */ + if (ci->ti_end_min == ti_current && t->skip && + t->type == task_type_sort && t->flags == 0) + error( + "Task (type='%s/%s') should not have been skipped ti_current=%d " + "c->ti_end_min=%d t->flags=%d", + taskID_names[t->type], subtaskID_names[t->subtype], ti_current, + ci->ti_end_min, t->flags); + + } else { /* pair */ + + if ((ci->ti_end_min == ti_current || cj->ti_end_min == ti_current) && + t->skip) + error( + "Task (type='%s/%s') should not have been skipped ti_current=%d " + "ci->ti_end_min=%d cj->ti_end_min=%d", + taskID_names[t->type], subtaskID_names[t->subtype], ti_current, + ci->ti_end_min, cj->ti_end_min); + } } } - #endif /* Loop over the tasks and enqueue whoever is ready. */ diff --git a/src/task.c b/src/task.c index 54b9363b7ac3d5c372b591c00b0b03cc274f66b5..c6ec6440f640f663a76085d272d29c2004e12163 100644 --- a/src/task.c +++ b/src/task.c @@ -372,32 +372,6 @@ int task_lock(struct task *t) { return 1; } -/** - * @brief Prints the list of tasks contained in a given mask - * - * @param mask The mask to analyse - */ -void task_print_mask(unsigned int mask) { - - printf("task_print_mask: The tasks to run are ["); - for (int k = 1; k < task_type_count; k++) - printf(" %s=%s", taskID_names[k], (mask & (1 << k)) ? "yes" : "no"); - printf(" ]\n"); -} - -/** - * @brief Prints the list of subtasks contained in a given submask - * - * @param submask The submask to analyse - */ -void task_print_submask(unsigned int submask) { - - printf("task_print_submask: The subtasks to run are ["); - for (int k = 1; k < task_subtype_count; k++) - printf(" %s=%s", subtaskID_names[k], (submask & (1 << k)) ? "yes" : "no"); - printf(" ]\n"); -} - /** * @brief Print basic information about a task. * diff --git a/src/task.h b/src/task.h index f840c0b4b8e807dce28f6f13479dbdf4995ab66d..57c198e27e03f261757daeaf36c3daf648ec8ac1 100644 --- a/src/task.h +++ b/src/task.h @@ -157,8 +157,6 @@ struct task { void task_unlock(struct task *t); float task_overlap(const struct task *ta, const struct task *tb); int task_lock(struct task *t); -void task_print_mask(unsigned int mask); -void task_print_submask(unsigned int submask); void task_do_rewait(struct task *t); void task_print(const struct task *t);