Skip to content
Snippets Groups Projects
Commit 1c1e2d4d authored by Matthieu Schaller's avatar Matthieu Schaller
Browse files

Added the parallel sorting tasks.

parent 18988f2d
No related branches found
No related tags found
2 merge requests!136Master,!79First version of the multiple time-stepping
...@@ -1063,6 +1063,11 @@ void engine_maketasks(struct engine *e) { ...@@ -1063,6 +1063,11 @@ void engine_maketasks(struct engine *e) {
/* Re-set the scheduler. */ /* Re-set the scheduler. */
scheduler_reset(sched, s->tot_cells * engine_maxtaskspercell); scheduler_reset(sched, s->tot_cells * engine_maxtaskspercell);
/* Add the space sorting tasks. */
for (i = 0; i < e->nr_threads; i++)
scheduler_addtask(sched, task_type_psort, task_subtype_none, i, 0, NULL,
NULL, 0);
/* Run through the highest level of cells and add pairs. */ /* Run through the highest level of cells and add pairs. */
for (i = 0; i < cdim[0]; i++) for (i = 0; i < cdim[0]; i++)
for (j = 0; j < cdim[1]; j++) for (j = 0; j < cdim[1]; j++)
...@@ -2268,6 +2273,13 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads, ...@@ -2268,6 +2273,13 @@ void engine_init(struct engine *e, struct space *s, float dt, int nr_threads,
scheduler_init(&e->sched, e->s, nr_queues, scheduler_flag_steal, e->nodeID); scheduler_init(&e->sched, e->s, nr_queues, scheduler_flag_steal, e->nodeID);
s->nr_queues = nr_queues; s->nr_queues = nr_queues;
/* Create the sorting tasks. */
for (i = 0; i < e->nr_threads; i++)
scheduler_addtask(&e->sched, task_type_psort, task_subtype_none, i, 0, NULL,
NULL, 0);
scheduler_ranktasks(&e->sched);
/* Allocate and init the threads. */ /* Allocate and init the threads. */
if ((e->runners = if ((e->runners =
(struct runner *)malloc(sizeof(struct runner) * nr_threads)) == NULL) (struct runner *)malloc(sizeof(struct runner) * nr_threads)) == NULL)
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment