Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

2 CPUs vs num_threads

Leos_P_
Beginner
587 Views

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)

0 Kudos
6 Replies
TimP
Honored Contributor III
587 Views

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).

0 Kudos
Bernard
Valued Contributor I
587 Views

Can you insert the call to GetLastError function?

0 Kudos
jimdempseyatthecove
Honored Contributor III
587 Views

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

0 Kudos
Vladimir_P_1234567890
587 Views

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.

0 Kudos
Bernard
Valued Contributor I
587 Views

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

0 Kudos
Bernard
Valued Contributor I
587 Views

>>> 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.

0 Kudos
Reply