I'm trying to parallelize a dynamic programming algorithm in C++11 using this approach:
void buildBaseCases() {
cout << "Building base cases" << endl;
for (unsigned int i = 0; i < BOARD_SIZE; ++i)
{
buildBaseCase(i);
}
cout << "Done building base cases" << endl;
}
So, my parallelized version would be something along the lines of:
void buildBaseCases() {
cout << "Building base cases" << endl;
#pragma omp parallel
{
#pragma omp for
for (unsigned int i = 0; i < BOARD_SIZE; ++i)
{
buildBaseCase(i);
}
}
cout << "Done building base cases" << endl;
}
However, this is causing valgrind to complain about memory leaking. Am I misunderstanding the way you're supposed to use openMP, or is there something fishy going on?
It turns out there was no problem at all. This was a duplicate of the issue described here: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36298
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.