tbb running out of threads on 80 core machine with Ubuntu

tbb running out of threads on 80 core machine with Ubuntu

Guido K.'s picture

I am trying to use tbb::parallel_for on a machine with 160 parallel threads (8 Intel E7-8870) and 0.5 TBytes of memory. It is a current Ubuntu system with kernel 3.2.0-35-generic #55-Ubuntu SMP. TBB is from the current download package release 4.1.

Even with a very simple task, I tend to run out of resources, either "bad_alloc" or "thread_monitor Resource temporarily unavailable". I boiled it down to this very simple test, which I attached as test.cpp.

Typical output is

Vector length: 10000000
Processes : 160
Starting loop
Loop finished
thread_monitor Resource temporarily unavailable in pthread_create
thread_monitor Resource temporarily unavailable in pthread_create
thread_monitor Resource temporarily unavailable in pthread_create
thread_monitor Resource temporarily unavailable in pthread_create

The errors appear randomly, and more frequent with greater vector length. The value of 10 million here is a point where they happen quite regularly. Nevertheless, given the machine characteristics, this should by far not exhaust the memory (I am using it alone for these tests).

The grain size was introduced after tbb created too many instances of the Worker, which made it fail for even smaller n.

Can anybody advise on how to set up tbb to handle large numbers of threads?

AttachmentSize
Download test.cpp827 bytes
3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Vladimir Polin (Intel)'s picture

Hello Guido,

I suppose this is the same question you asked on http://stackoverflow.com/questions/14830024/tbbparallel-for-running-out-...  

My guess is also that it looks that stack size is too big. More hints about the problem you can find here http://stackoverflow.com/questions/344203/maximum-number-of-threads-per-process-in-linux

But we will check what is behavior on usual machine and maybe find how to increase the number of threads.
--Vladimir

Guido K.'s picture

Hello Vladimir,

it is. And I just found the embarrassing solution. A ulimit on my account.

Best, Guido

Login to leave a comment.