Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

tbb running out of threads on 80 core machine with Ubuntu

Guido_K_1
Beginner
576 Views

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?

0 Kudos
2 Replies
Vladimir_P_1234567890
576 Views

Hello Guido,

I suppose this is the same question you asked on http://stackoverflow.com/questions/14830024/tbbparallel-for-running-out-of-memory-on-machine-with-80-cores  ;

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

0 Kudos
Guido_K_1
Beginner
576 Views

Hello Vladimir,

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

Best, Guido

0 Kudos
Reply