2 CPUs vs num_threads

2 CPUs vs num_threads

Ritratto di Leos P.

I have 2 xeon CPUs in the PC, each has 4 cores. However, I can only set num_threads to 4. If I set it to a number > 4, I get a message:

OMP: Error #136: Cannot create thread.
OMP: System error #8: Not enough storage is available to process this command.
OMP: Error #178: Function GetExitCodeThread() failed:
OMP: System error #6: The handle is invalid.

Is it not possible to use all the cores in the system because they are distributed across 2 cpus or why is this happening?

(Compiler: Intel C++ 13.0
OS: Windows server 2008 R2)

7 post / 0 new
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione
Ritratto di Tim Prince

Are you building for 32-bit mode?  I suppose it can be difficult to use 8 cores if you inadvertently use that mode.

Did you try allowing more stack?

Did you note prior posts on this subject?  Please tell us if you can rule out or follow any of the suggestions there (too many to repeat here).

Ritratto di iliyapolak

Can you insert the call to GetLastError function?

Ritratto di jimdempseyatthecove

A common mistake is to link your program specifying "unlimited stack" or some unwieldy large stack size. It does not make sense to make such a request for multi-threaded programs. Assume you have 32-bit application and you specify 1GB of stack in the link line. Threads your app creates default to this size. Your application will run out of memory (run out of virtual address space). For 32-bit app, your working space for the app is either 2GB or 3GB (leaving 2GB or 1GB for the O/S).

Assuming you are running 64-bit app, While you will not run out of virtual address space, you may run out of swap file space. The corrective measure is to reduce the stack size and rely more on allocation from the heap. This will reduce the per-thread memory requirements.

Jim Dempsey

www.quickthreadprogramming.com
Ritratto di Vladimir Polin (Intel)

Quote:

iliyapolak wrote:

Can you insert the call to GetLastError function?

the library puts the result of GetLastError 

OMP: System error #8: Not enough storage is available to process this command.

Ritratto di iliyapolak

When your app is 32-bit and it is running inside WoW container process it can use up to 4GB of address space.

Ritratto di iliyapolak

>>> Assume you have 32-bit application and you specify 1GB of stack in the link line. Threads your app creates default to this size.>>>

IIRC each newly created thread will have overridden its default stack size so virtual memory allocated to this specific process will run out.

Accedere per lasciare un commento.