diff --git a/src/engine.c b/src/engine.c index 0b887296d6cce35a3974d3c3f1355690cf753a56..284b9cfe83bee77948b3f0c741bedc4ef3697136 100644 --- a/src/engine.c +++ b/src/engine.c @@ -1820,101 +1820,106 @@ static inline void engine_make_external_gravity_dependencies( */ void engine_link_gravity_tasks(struct engine *e) { - struct scheduler *sched = &e->sched; - const int nodeID = e->nodeID; - const int nr_tasks = sched->nr_tasks; + /* struct scheduler *sched = &e->sched; */ + /* const int nodeID = e->nodeID; */ + /* const int nr_tasks = sched->nr_tasks; */ - /* Add one task gathering all the multipoles */ - struct task *gather = scheduler_addtask( - sched, task_type_grav_gather_m, task_subtype_none, 0, 0, NULL, NULL, 0); + /* /\* Add one task gathering all the multipoles *\/ */ + /* struct task *gather = scheduler_addtask( */ + /* sched, task_type_grav_gather_m, task_subtype_none, 0, 0, NULL, NULL, + * 0); */ - /* And one task performing the FFT */ - struct task *fft = scheduler_addtask(sched, task_type_grav_fft, - task_subtype_none, 0, 0, NULL, NULL, 0); + /* /\* And one task performing the FFT *\/ */ + /* struct task *fft = scheduler_addtask(sched, task_type_grav_fft, */ + /* task_subtype_none, 0, 0, NULL, NULL, + * 0); */ - scheduler_addunlock(sched, gather, fft); + /* scheduler_addunlock(sched, gather, fft); */ - for (int k = 0; k < nr_tasks; k++) { + /* for (int k = 0; k < nr_tasks; k++) { */ - /* Get a pointer to the task. */ - struct task *t = &sched->tasks[k]; + /* /\* Get a pointer to the task. *\/ */ + /* struct task *t = &sched->tasks[k]; */ - /* Multipole construction */ - if (t->type == task_type_grav_up) { - scheduler_addunlock(sched, t, gather); - } + /* /\* Multipole construction *\/ */ + /* if (t->type == task_type_grav_up) { */ + /* scheduler_addunlock(sched, t, gather); */ + /* } */ - /* Long-range interaction */ - if (t->type == task_type_grav_mm) { + /* /\* Long-range interaction *\/ */ + /* if (t->type == task_type_grav_mm) { */ - /* Gather the multipoles --> mm interaction --> kick */ - scheduler_addunlock(sched, gather, t); - scheduler_addunlock(sched, t, t->ci->super->kick2); + /* /\* Gather the multipoles --> mm interaction --> kick *\/ */ + /* scheduler_addunlock(sched, gather, t); */ + /* scheduler_addunlock(sched, t, t->ci->super->kick2); */ - /* init --> mm interaction */ - scheduler_addunlock(sched, t->ci->super->init, t); - } + /* /\* init --> mm interaction *\/ */ + /* scheduler_addunlock(sched, t->ci->super->init, t); */ + /* } */ - /* Self-interaction for self-gravity? */ - if (t->type == task_type_self && t->subtype == task_subtype_grav) { + /* /\* Self-interaction for self-gravity? *\/ */ + /* if (t->type == task_type_self && t->subtype == task_subtype_grav) { */ - engine_make_gravity_dependencies(sched, t, t->ci); + /* engine_make_gravity_dependencies(sched, t, t->ci); */ - } + /* } */ - /* Self-interaction for external gravity ? */ - else if (t->type == task_type_self && - t->subtype == task_subtype_external_grav) { + /* /\* Self-interaction for external gravity ? *\/ */ + /* else if (t->type == task_type_self && */ + /* t->subtype == task_subtype_external_grav) { */ - engine_make_external_gravity_dependencies(sched, t, t->ci); + /* engine_make_external_gravity_dependencies(sched, t, t->ci); */ - } + /* } */ - /* Otherwise, pair interaction? */ - else if (t->type == task_type_pair && t->subtype == task_subtype_grav) { + /* /\* Otherwise, pair interaction? *\/ */ + /* else if (t->type == task_type_pair && t->subtype == task_subtype_grav) { + */ - if (t->ci->nodeID == nodeID) { + /* if (t->ci->nodeID == nodeID) { */ - engine_make_gravity_dependencies(sched, t, t->ci); - } + /* engine_make_gravity_dependencies(sched, t, t->ci); */ + /* } */ - if (t->cj->nodeID == nodeID && t->ci->super != t->cj->super) { + /* if (t->cj->nodeID == nodeID && t->ci->super != t->cj->super) { */ - engine_make_gravity_dependencies(sched, t, t->cj); - } + /* engine_make_gravity_dependencies(sched, t, t->cj); */ + /* } */ - } + /* } */ - /* Otherwise, sub-self interaction? */ - else if (t->type == task_type_sub_self && t->subtype == task_subtype_grav) { + /* /\* Otherwise, sub-self interaction? *\/ */ + /* else if (t->type == task_type_sub_self && t->subtype == + * task_subtype_grav) { */ - if (t->ci->nodeID == nodeID) { - engine_make_gravity_dependencies(sched, t, t->ci); - } - } + /* if (t->ci->nodeID == nodeID) { */ + /* engine_make_gravity_dependencies(sched, t, t->ci); */ + /* } */ + /* } */ - /* Sub-self-interaction for external gravity ? */ - else if (t->type == task_type_sub_self && - t->subtype == task_subtype_external_grav) { + /* /\* Sub-self-interaction for external gravity ? *\/ */ + /* else if (t->type == task_type_sub_self && */ + /* t->subtype == task_subtype_external_grav) { */ - if (t->ci->nodeID == nodeID) { - engine_make_external_gravity_dependencies(sched, t, t->ci); - } - } + /* if (t->ci->nodeID == nodeID) { */ + /* engine_make_external_gravity_dependencies(sched, t, t->ci); */ + /* } */ + /* } */ - /* Otherwise, sub-pair interaction? */ - else if (t->type == task_type_sub_pair && t->subtype == task_subtype_grav) { + /* /\* Otherwise, sub-pair interaction? *\/ */ + /* else if (t->type == task_type_sub_pair && t->subtype == + * task_subtype_grav) { */ - if (t->ci->nodeID == nodeID) { + /* if (t->ci->nodeID == nodeID) { */ - engine_make_gravity_dependencies(sched, t, t->ci); - } - if (t->cj->nodeID == nodeID && t->ci->super != t->cj->super) { + /* engine_make_gravity_dependencies(sched, t, t->ci); */ + /* } */ + /* if (t->cj->nodeID == nodeID && t->ci->super != t->cj->super) { */ - engine_make_gravity_dependencies(sched, t, t->cj); - } - } - } + /* engine_make_gravity_dependencies(sched, t, t->cj); */ + /* } */ + /* } */ + /* } */ } #ifdef EXTRA_HYDRO_LOOP @@ -2189,32 +2194,34 @@ void engine_make_extra_hydroloop_tasks(struct engine *e) { */ void engine_make_gravityrecursive_tasks(struct engine *e) { - struct space *s = e->s; - struct scheduler *sched = &e->sched; - const int nodeID = e->nodeID; - const int nr_cells = s->nr_cells; - struct cell *cells = s->cells_top; - - for (int k = 0; k < nr_cells; k++) { - - /* Only do this for local cells containing gravity particles */ - if (cells[k].nodeID == nodeID && cells[k].gcount > 0) { - - /* Create tasks at top level. */ - struct task *up = - scheduler_addtask(sched, task_type_grav_up, task_subtype_none, 0, 0, - &cells[k], NULL, 0); - - struct task *down = NULL; - /* struct task *down = */ - /* scheduler_addtask(sched, task_type_grav_down, task_subtype_none, 0, - * 0, */ - /* &cells[k], NULL, 0); */ - - /* Push tasks down the cell hierarchy. */ - engine_addtasks_grav(e, &cells[k], up, down); - } - } + /* struct space *s = e->s; */ + /* struct scheduler *sched = &e->sched; */ + /* const int nodeID = e->nodeID; */ + /* const int nr_cells = s->nr_cells; */ + /* struct cell *cells = s->cells_top; */ + + /* for (int k = 0; k < nr_cells; k++) { */ + + /* /\* Only do this for local cells containing gravity particles *\/ */ + /* if (cells[k].nodeID == nodeID && cells[k].gcount > 0) { */ + + /* /\* Create tasks at top level. *\/ */ + /* struct task *up = */ + /* scheduler_addtask(sched, task_type_grav_up, task_subtype_none, 0, + * 0, */ + /* &cells[k], NULL, 0); */ + + /* struct task *down = NULL; */ + /* /\* struct task *down = *\/ */ + /* /\* scheduler_addtask(sched, task_type_grav_down, + * task_subtype_none, 0, */ + /* * 0, *\/ */ + /* /\* &cells[k], NULL, 0); *\/ */ + + /* /\* Push tasks down the cell hierarchy. *\/ */ + /* engine_addtasks_grav(e, &cells[k], up, down); */ + /* } */ + /* } */ } /** @@ -2489,10 +2496,10 @@ void engine_marktasks_mapper(void *map_data, int num_elements, } /* Tasks with no cells should not be skipped? */ - else if (t->type == task_type_grav_gather_m || - t->type == task_type_grav_fft) { - scheduler_activate(s, t); - } + /* else if (t->type == task_type_grav_gather_m || */ + /* t->type == task_type_grav_fft) { */ + /* scheduler_activate(s, t); */ + /* } */ } } diff --git a/src/runner.c b/src/runner.c index 9a4aaedf0814cf66e4d025b0759796a9ecf1495e..4ab2f649f44360329550473787b15a2876ad70fb 100644 --- a/src/runner.c +++ b/src/runner.c @@ -1579,8 +1579,7 @@ void *runner_main(void *data) { #ifndef WITH_MPI if (ci == NULL && cj == NULL) { - if (t->type != task_type_grav_gather_m && t->type != task_type_grav_fft) - error("Task not associated with cells!"); + error("Task not associated with cells!"); } else if (cj == NULL) { /* self */ @@ -1738,14 +1737,14 @@ void *runner_main(void *data) { case task_type_grav_mm: runner_do_grav_mm(r, t->ci, 1); break; - case task_type_grav_up: - runner_do_grav_up(r, t->ci); - break; - case task_type_grav_gather_m: - break; - case task_type_grav_fft: - runner_do_grav_fft(r); - break; + /* case task_type_grav_up: */ + /* runner_do_grav_up(r, t->ci); */ + /* break; */ + /* case task_type_grav_gather_m: */ + /* break; */ + /* case task_type_grav_fft: */ + /* runner_do_grav_fft(r); */ + /* break; */ case task_type_cooling: if (e->policy & engine_policy_cooling) runner_do_end_force(r, ci, 1); runner_do_cooling(r, t->ci, 1); diff --git a/src/scheduler.c b/src/scheduler.c index f98c1082afbf7ec029a7556e36eb9d18ed37bd0a..e5e53096d8327053911c9369a8a108f683ab5ebe 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -1092,8 +1092,7 @@ void scheduler_start(struct scheduler *s) { if (ci == NULL && cj == NULL) { - if (t->type != task_type_grav_gather_m && t->type != task_type_grav_fft) - error("Task not associated with cells!"); + error("Task not associated with cells!"); } else if (cj == NULL) { /* self */ diff --git a/src/task.c b/src/task.c index b05d782af305b25bf95b25279c6abc2e1f4037c2..94ca156c1d7a6180eee1348f834ea77f59f52fb3 100644 --- a/src/task.c +++ b/src/task.c @@ -47,12 +47,27 @@ #include "lock.h" /* Task type names. */ -const char *taskID_names[task_type_count] = { - "none", "sort", "self", "pair", "sub_self", - "sub_pair", "init", "ghost", "extra_ghost", "drift", - "kick1", "kick2", "timestep", "send", "recv", - "grav_gather_m", "grav_fft", "grav_mm", "grav_up", "cooling", - "sourceterms"}; +const char *taskID_names[task_type_count] = {"none", + "sort", + "self", + "pair", + "sub_self", + "sub_pair", + "init", + "ghost", + "extra_ghost", + "drift", + "kick1", + "kick2", + "timestep", + "send", + "recv", + "grav_top_level", + "grav_long_range", + "grav_mm", + "grav_down", + "cooling", + "sourceterms"}; const char *subtaskID_names[task_subtype_count] = { "none", "density", "gradient", "force", "grav", "external_grav", @@ -165,13 +180,15 @@ __attribute__((always_inline)) INLINE static enum task_actions task_acts_on( error("Task without particles"); break; - case task_type_grav_gather_m: - case task_type_grav_fft: + case task_type_grav_top_level: + case task_type_grav_long_range: case task_type_grav_mm: - case task_type_grav_up: return task_action_multipole; break; + case task_type_grav_down: + return task_action_gpart; + default: error("Unknown task_action for task"); return task_action_none; diff --git a/src/task.h b/src/task.h index f2733318a34421fa39f3130f9e76f1ed09246d55..39f67fef84dc8d02e6cd8555c608d2ad18c1c470 100644 --- a/src/task.h +++ b/src/task.h @@ -51,10 +51,10 @@ enum task_types { task_type_timestep, task_type_send, task_type_recv, - task_type_grav_gather_m, - task_type_grav_fft, + task_type_grav_top_level, + task_type_grav_long_range, task_type_grav_mm, - task_type_grav_up, + task_type_grav_down, task_type_cooling, task_type_sourceterms, task_type_count