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

Status before debuggin session

parent 4304f0ad
......@@ -397,7 +397,7 @@ int main(int argc, char *argv[]) {
/* Take a step. */
engine_step(&e);
if (j == 5) break;
if (j == 1) break;
if (with_outputs && j % 100 == 0) {
......
......@@ -2009,8 +2009,6 @@ if ( e->nodeID == 0 )
scheduler_print_tasks(&e->sched, "tasks_after.dat");
error("done step");
TIMER_TOC(timer_runners);
TIMER_TOC2(timer_step);
......
......@@ -1193,30 +1193,7 @@ void *runner_main(void *data) {
space_split(e->s, t->ci);
break;
case task_type_rewait:
for (struct task *t2 = (struct task *)t->ci;
t2 != (struct task *)t->cj; t2++) {
if(store == NULL && t2->type==task_type_pair && t2->subtype==task_subtype_density) {
message("\n");
message("Checking task %s-%s address: %p", taskID_names[t2->type], subtaskID_names[t2->subtype], t2);
store = t2;
}
for (int k = 0; k < t2->nr_unlock_tasks; k++) {
if(t2->type == task_type_sort && t2->flags == 0) continue;
atomic_inc(&t2->unlock_tasks[k]->wait);
struct task *t3=t2->unlock_tasks[k];
if (t3 == store) {
message("Unlocked by task %s-%s address: %p" , taskID_names[t2->type], subtaskID_names[t2->subtype], t2);
}
}
}
task_do_rewait(t);
break;
default:
error("Unknown task type.");
......
......@@ -26,9 +26,8 @@
#include "part.h"
#include "vector.h"
/* #define PRINT_PARTS \ */
/* void; */
/*if (pi->id == 1000) { \
#define PRINT_PARTS \
if (pi->id == 1000) { \
message( \
"pi->id=%lld pi->h=%f pi->N_ngb=%f pi->rho=%f pi->t_beg=%f pi->t_end=%f pos=[%f %f %f]", \
pi->id, pi->h, pi->density.wcount, pi->rho, pi->t_begin, pi->t_end, pi->x[0], pi->x[1], pi->x[2]); \
......@@ -39,7 +38,6 @@
pj->id, pj->h, pj->density.wcount, pj->rho, pj->t_begin, pj->t_end, pj->x[0], pj->x[1], pj->x[2]); \
}\
fflush(stdout);
*/
/**
......@@ -74,7 +72,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_density(
float dv[3], curlvr[3];
int k;
//PRINT_PARTS;
PRINT_PARTS;
/* Get the masses. */
mi = pi->mass;
......@@ -250,7 +248,7 @@ __attribute__((always_inline)) INLINE static void runner_iact_nonsym_density(
float dv[3], curlvr[3];
int k;
//PRINT_PARTS;
PRINT_PARTS;
/* Get the masses. */
mj = pj->mass;
......
......@@ -983,13 +983,21 @@ void scheduler_start(struct scheduler *s, unsigned int mask) {
? s->size - s->nr_tasks
: s->nr_queues;
const int waiting_old =
s->waiting; // Remember that engine_launch may fiddle with this value.
/* Remember that engine_launch may fiddle with this value. */
const int waiting_old = s->waiting;
/* We are going to use the task structure in a modified way to pass information
to the task. Don't do this at home !
- ci and cj will give the range of tasks to which the waits will be applied
- the flags will be used to transfer the mask
- the rest is unused.
*/
for (int k = 0; k < num_rewait_tasks; k++) {
rewait_tasks[k].type = task_type_rewait;
rewait_tasks[k].ci = (struct cell *)&s->tasks[k * nr_tasks / s->nr_queues];
rewait_tasks[k].cj =
(struct cell *)&s->tasks[(k + 1) * nr_tasks / s->nr_queues];
rewait_tasks[k].flags = s->mask;
rewait_tasks[k].skip = 0;
rewait_tasks[k].wait = 0;
rewait_tasks[k].rid = -1;
......
......@@ -41,6 +41,8 @@
#include "error.h"
#include "lock.h"
struct task *store;
/* Task type names. */
const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub", "init",
......@@ -267,3 +269,41 @@ void task_print_mask(unsigned int mask) {
printf(" %s=%s", taskID_names[k], (mask & (1 << k)) ? "yes" : "no");
printf(" ]\n");
}
void task_do_rewait(struct task *t) {
const unsigned int mask = t->flags;
for (struct task *t2 = (struct task *)t->ci; t2 != (struct task *)t->cj; t2++) {
if( t2->skip ) continue;
/* Skip tasks not in the mask */
if( !((1<<t2->type) & mask) ) continue;
/* Skip sort tasks that have already been performed */
if(t2->type == task_type_sort && t2->flags == 0) continue;
if(store == NULL && t2->type==task_type_pair && t2->subtype==task_subtype_density) {
message("\n");
message("Checking task %s-%s address: %p", taskID_names[t2->type], subtaskID_names[t2->subtype], t2);
store = t2;
}
for (int k = 0; k < t2->nr_unlock_tasks; k++) {
struct task *t3=t2->unlock_tasks[k];
atomic_inc(&t3->wait);
if (t3 == store) {
message("Unlocked by task %s-%s address: %p" , taskID_names[t2->type], subtaskID_names[t2->subtype], t2);
}
}
}
}
......@@ -95,5 +95,6 @@ void task_addunlock(struct task *ta, struct task *tb);
void task_unlock(struct task *t);
int task_lock(struct task *t);
void task_print_mask(unsigned int mask);
void task_do_rewait(struct task *t);
#endif /* SWIFT_TASK_H */
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