Commit e00fb2f4 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

made engine_count_and_link_tasks parallel with the threadpool, required some minor fixes.

parent a84a7a88
......@@ -1456,7 +1456,6 @@ void engine_maketasks(struct engine *e) {
of its super-cell. */
threadpool_map(&e->threadpool, engine_make_extra_hydroloop_tasks_mapper,
sched->tasks, sched->nr_tasks, sizeof(struct task), e);
// engine_make_extra_hydroloop_tasks(e);
/* Add the communication tasks if MPI is being used. */
if (e->policy & engine_policy_mpi) {
......
......@@ -729,15 +729,12 @@ void scheduler_set_unlocks(struct scheduler *s) {
offsets[0] = 0;
for (int k = 1; k < s->nr_tasks; k++)
offsets[k] = offsets[k - 1] + counts[k - 1];
for (int k = 0; k < s->nr_tasks; k++)
for (int j = offsets[k]; j < offsets[k + 1]; j++) s->unlock_ind[j] = k;
/* Set the unlocks in the tasks. */
for (int k = 0; k < s->nr_tasks; k++) {
struct task *t = &s->tasks[k];
t->nr_unlock_tasks = counts[k];
t->unlock_tasks = &s->unlocks[offsets[k]];
for (int j = offsets[k]; j < offsets[k + 1]; j++) s->unlock_ind[j] = k;
}
/* Verify that there are no duplicate unlocks. */
......
......@@ -49,7 +49,7 @@
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", "comm_root "};
"grav_mm", "grav_up", "grav_down", "grav_external", "comm_root"};
const char *subtaskID_names[task_type_count] = {"none", "density",
"force", "grav"};
......
......@@ -50,9 +50,7 @@ void *threadpool_runner(void *data) {
/* Wait for a signal. */
pthread_mutex_lock(&tp->thread_mutex);
do {
pthread_cond_wait(&tp->thread_cond, &tp->thread_mutex);
} while (tp->map_function == NULL);
pthread_cond_wait(&tp->thread_cond, &tp->thread_mutex);
pthread_mutex_unlock(&tp->thread_mutex);
/* The index of the mapping task we will work on next. */
......
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