Hello OpenMP-Users!
I am trying to parallelize an existing seriell programm with openmp. Thereby I encountered a severe problem while traversing stl-containers.
Following example seems to slow down my code heavily, when executed within a parallel region.
for (iter = vector.begin(); iter!=vector.end();iter++)
{
iter->doanything(...);
}
If I use random access on the vector instead I do not have these problems.
for (int iter = 0; iter < vector.size(); iter++)
{
vector[iter].doanything(...);
}
It seems like in the first variant is only executed serially, reaping all the benefits of parallel execution. But i cannot imagine why ?
And is there any way to circumvent this problem without having to change all the iterator-loops within my serial program?
Thanks for your help,
Christian
