Skip to content

Commit

Permalink
Fix openMP build
Browse files Browse the repository at this point in the history
Tested to compile on VC12 with openMP activated.

With two loops over the same unit list, 'guided' scheduling (as done
before the second loop was introduced) isn't optimal.

[ci skip]
  • Loading branch information
aquileia committed Jun 24, 2014
1 parent 6698f59 commit 939af32
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/display.cpp
Expand Up @@ -3098,13 +3098,12 @@ void display::invalidate_animations()
open_mp_list.push_back(u);
}

#pragma omp parallel shared(chunks)
{
#pragma omp for
for(size_t i = 0; i < open_mp_list.size(); ++i)
open_mp_list[i]->anim_comp().refresh();
// openMP can't iterate over size_t
const int omp_iterations = open_mp_list.size();
#pragma omp parallel for shared(open_mp_list)
for (int i = 0; i < omp_iterations; i++) {
open_mp_list[i]->anim_comp().refresh();
}
}
#endif


Expand All @@ -3119,14 +3118,12 @@ void display::invalidate_animations()
new_inval |= u->anim_comp().invalidate(*this);
}
#else
#pragma omp parallel shared(chunks)
{
#pragma omp for
for(size_t i = 0; i < open_mp_list.size(); ++i)
#pragma omp parallel for reduction(|:new_inval) shared(open_mp_list)
for (int i = 0; i < omp_iterations; i++) {
new_inval |= open_mp_list[i]->anim_comp().invalidate(*this);
}
#endif
}while(new_inval);
} while (new_inval);
}

void display::add_arrow(arrow& arrow)
Expand Down

0 comments on commit 939af32

Please sign in to comment.