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