Commit 35409e10 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

well, there go the split_cell tasks...

parent 4d022972
......@@ -1401,9 +1401,6 @@ void *runner_main(void *data) {
case task_type_gpart_sort:
space_do_gparts_sort();
break;
case task_type_split_cell:
space_do_split(e->s, t->ci);
break;
case task_type_comm_root:
break;
default:
......
......@@ -952,6 +952,7 @@ void scheduler_reweight(struct scheduler *s) {
* @brief #threadpool_map function which runs through the task
* graph and re-computes the task wait counters.
*/
void scheduler_rewait_mapper(void *map_data, void *extra_data) {
struct scheduler *s = (struct scheduler *)extra_data;
......@@ -960,8 +961,7 @@ void scheduler_rewait_mapper(void *map_data, void *extra_data) {
if (t->skip) return;
/* Skip tasks not in the mask */
if (!((1 << t->type) & s->mask) || !((1 << t->subtype) & s->submask))
return;
if (!((1 << t->type) & s->mask) || !((1 << t->subtype) & s->submask)) return;
/* Skip sort tasks that have already been performed */
if (t->type == task_type_sort && t->flags == 0) return;
......
......@@ -47,6 +47,7 @@
#include "lock.h"
#include "minmax.h"
#include "runner.h"
#include "threadpool.h"
#include "tools.h"
/* Shared sort structure. */
......@@ -655,10 +656,8 @@ void space_split(struct space *s, struct cell *cells, int verbose) {
const ticks tic = getticks();
for (int k = 0; k < s->nr_cells; k++)
scheduler_addtask(&s->e->sched, task_type_split_cell, task_subtype_none, k,
0, &cells[k], NULL, 0);
engine_launch(s->e, s->e->nr_threads, 1 << task_type_split_cell, 0);
threadpool_map(&s->e->threadpool, space_split_mapper, cells, s->nr_cells,
sizeof(struct cell), s);
if (verbose)
message("took %.3f %s.", clocks_from_ticks(getticks() - tic),
......@@ -1199,13 +1198,15 @@ void space_map_cells_pre(struct space *s, int full,
}
/**
* @brief Split cells that contain too many particles.
*
* @param s The #space we are working in.
* @param c The #cell under consideration.
* @brief #threadpool mapper function to split cells if they contain
* too many particles.
*/
void space_do_split(struct space *s, struct cell *c) {
void space_split_mapper(void *map_data, void *extra_data) {
/* Unpack the inputs. */
struct space *s = (struct space *)extra_data;
struct cell *c = (struct cell *)map_data;
const int count = c->count;
const int gcount = c->gcount;
......@@ -1259,7 +1260,7 @@ void space_do_split(struct space *s, struct cell *c) {
space_recycle(s, c->progeny[k]);
c->progeny[k] = NULL;
} else {
space_do_split(s, c->progeny[k]);
space_split_mapper(c->progeny[k], s);
h_max = fmaxf(h_max, c->progeny[k]->h_max);
ti_end_min = min(ti_end_min, c->progeny[k]->ti_end_min);
ti_end_max = max(ti_end_max, c->progeny[k]->ti_end_max);
......
......@@ -154,7 +154,7 @@ void space_map_cells_post(struct space *s, int full,
void space_rebuild(struct space *s, double h_max, int verbose);
void space_recycle(struct space *s, struct cell *c);
void space_split(struct space *s, struct cell *cells, int verbose);
void space_do_split(struct space *s, struct cell *c);
void space_split_mapper(void *map_data, void *extra_data);
void space_do_parts_sort();
void space_do_gparts_sort();
void space_link_cleanup(struct space *s);
......
......@@ -47,10 +47,10 @@
/* Task type names. */
const char *taskID_names[task_type_count] = {
"none", "sort", "self", "pair", "sub",
"init", "ghost", "drift", "kick", "send",
"recv", "grav_pp", "grav_mm", "grav_up", "grav_down",
"grav_external", "part_sort", "gpart_sort", "split_cell", "comm_root "};
"none", "sort", "self", "pair", "sub",
"init", "ghost", "drift", "kick", "send",
"recv", "grav_pp", "grav_mm", "grav_up", "grav_down",
"grav_external", "part_sort", "gpart_sort", "comm_root "};
const char *subtaskID_names[task_type_count] = {"none", "density",
"force", "grav"};
......@@ -84,9 +84,8 @@ float task_overlap(const struct task *ta, const struct task *tb) {
use cells. */
if (ta == NULL || tb == NULL || ta->type == task_type_none ||
ta->type == task_type_part_sort || ta->type == task_type_gpart_sort ||
ta->type == task_type_split_cell || tb->type == task_type_none ||
tb->type == task_type_part_sort || tb->type == task_type_gpart_sort ||
tb->type == task_type_split_cell)
tb->type == task_type_none || tb->type == task_type_part_sort ||
tb->type == task_type_gpart_sort)
return 0.0f;
/* Compute the union of the cell data. */
......
......@@ -51,7 +51,6 @@ enum task_types {
task_type_grav_external,
task_type_part_sort,
task_type_gpart_sort,
task_type_split_cell,
task_type_comm_root,
task_type_count
};
......
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