views:

401

answers:

4
+1  Q: 

OpenMP on Intel i7

I have a problem with openMP in i7 CPU.

I have used openMP just to parallel a 'for' loop. Algorithm was used on several different PC's and worked without any problem. Recently, we tried to run it on i7 system and we got a problem on it. Software usually runs for some time and after several cycles it reported "not enough memory" and we tried to find a memory leak, but instead we found that the used stack size of the software was too big - there were a lot of 1Mb threads not closed. Somehow threads created by the openMP were all stuck in the stack and memory was filled with them.

Did anyone experienced ever such a behavior? The code is very simple, just a 'pragma omp parallel for' with some cycle, which works ok on other PC's.

I am using Microsoft Visual C++ 9.0 compiler with build-in openMP library.

Thank you Sergei

A: 

You could try using the Intel Thread Building Blocks library (TBB) it is very similar to OpenMP and really easier to parallelize a for loop in the manner you described - to see if there is any difference.

TheVinn
A: 

That sounds like an OS issue rather than application problem. I assume the compiler generating same assembly for the same code. If you have some old hyper-threaded cpu you can try your code, see if the same problem happens there.

leiz
+2  A: 

Thank you for answers. I figured out that when OpenMP starts some paralleled loop it opens several threads, which do not stop at the end, but reused on another paralleled loop. In the case of i7, they do not reused but always a new one created for each paralleled loop, so there is stable 1Mb stack grow.

I also tried to write a very simple application, which just uses openMP for to parallelize several loop and I did not observed any problem with it on i7. Looks like in the main software there are some conditions which allows such problem with parallelization. Trying to find more...

Sergei
work/thread teams are often reused in OpenMP as its part of its implementation afaik. just an fyi.
Raymond Tay
A: 

Did you have any luck in finding what the issue is.

I am having the same issue, where in openMP threads are not getting terminated and they stay there leaking 1MB of stack.

ra84