Commit 7019f7b4 authored by Pedro Gonnet's avatar Pedro Gonnet
Browse files

parallelize particle and task init.


Former-commit-id: 34fff717ccaff6ee8c5e9448cbd855857b5aec57
parent b150ea1b
......@@ -197,6 +197,7 @@ void engine_run ( struct engine *e , int sort_queues ) {
struct space *s = e->s;
/* Re-set the particle data. */
#pragma omp parallel for
for ( k = 0 ; k < s->nr_parts ; k++ ) {
s->parts[k].wcount = 0.0f;
s->parts[k].wcount_dh = 0.0f;
......@@ -205,11 +206,12 @@ void engine_run ( struct engine *e , int sort_queues ) {
}
/* Run throught the tasks and get all the waits right. */
#pragma omp parallel for private(j)
for ( k = 0 ; k < s->nr_tasks ; k++ ) {
for ( j = 0 ; j < s->tasks[k].nr_unlock_tasks ; j++ )
s->tasks[k].unlock_tasks[j]->wait += 1;
__sync_add_and_fetch( &s->tasks[k].unlock_tasks[j]->wait , 1 );
for ( j = 0 ; j < s->tasks[k].nr_unlock_cells ; j++ )
s->tasks[k].unlock_cells[j]->wait += 1;
__sync_add_and_fetch( &s->tasks[k].unlock_cells[j]->wait , 1 );
}
/* Re-set the queues.*/
......
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