Commit 4aabe9b0 authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Also modify the debugging code

parent e8212587
......@@ -108,6 +108,6 @@
//#define COOLING_GRACKLE
/* Are we debugging ? */
//#define SWIFT_DEBUG_CHECKS
#define SWIFT_DEBUG_CHECKS
#endif /* SWIFT_CONST_H */
......@@ -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. */
......
......@@ -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.
*
......
......@@ -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);
......
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