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

parallel_for and thread_monitor::launch: _beginthreadex failed

Jason_W_
Beginner
853 Views

Hi I've just recently been having trouble running parallel_for loops. I'm using TBB as part of Parallel Studio XE 2017 Cluster Edition. With no changes to my code, I have been receiving the error message thread_monitor::launch: _beginthreadex failed whenever my program reaches my parallel_for loop and crashes my program. This recently has also been happening to my other projects too. My project involves capturing images with multiple cameras with each camera running in parallel with each other. However, when I set the number of images captured for each camera say over 100 (which should be no problem on the hardware side of things), the error appears. In some of my projects, within the parallel_for there's also a parallel_pipeline within them and some without. All of them seem to crash with this error when I increase number of images to be captured. Any ideas?

0 Kudos
1 Solution
James_T_Intel
Moderator
853 Views

This should be resolved by compiling for x64 to take advantage of the system memory available.  Please confirm.

View solution in original post

0 Kudos
6 Replies
Alexei_K_Intel
Employee
853 Views

Hi Jason,

I do not know the exact reason of the failure but I can suppose that it is an "out of resources" problem. Do you specify how many threads should be used? Do you specify stack size? What Intel TBB API do you use?

Regards,
Alex

0 Kudos
Jason_W_
Beginner
853 Views

Alex (Intel) wrote:

I do not know the exact reason of the failure but I can suppose that it is an "out of resources" problem. Do you specify how many threads should be used? Do you specify stack size? What Intel TBB API do you use?

Hi Alex,

I am sort of a beginner at using TBB, but the loop runs from 0-15 and for my pipeline the max number of threads I'm stating is 4000. And I am not explicitly stating threads should be used otherwise or stack size. And I'm running TBB Interface Version 9.106. 

Best,

Jason

0 Kudos
Alexei_K_Intel
Employee
853 Views

Hi Jason,

What do you mean with the max number of threads for pipeline? There is no interface to specify the number of threads in pipeline. Do you mean max_number_of_live_token?

I do not know the sizes of your data structures but 4000 copies of some data can require significant amount of memory. E.g. one image can be a couple of megabytes, if we take 4000 images it can consume up to 10GB (or even more). Is it Ok for your hardware? Can you estimate the memory consumption of your application? Do you have enough RAM?

Regards,
Alex

0 Kudos
Jason_W_
Beginner
853 Views

Hi Alex,

My mistake. I meant max_number_of_live_token. My machine has 256 GB of RAM and enough disk space left. However, the application seems to crash before any of the really intensive processes even begin in my code. For example if I write a cout in the first line within my parallel_for, the application crashes without printing it.

Best,

Jason

0 Kudos
James_T_Intel
Moderator
854 Views

This should be resolved by compiling for x64 to take advantage of the system memory available.  Please confirm.

0 Kudos
Jason_W_
Beginner
853 Views

James T. (Intel) wrote:

This should be resolved by compiling for x64 to take advantage of the system memory available.  Please confirm.

That solved it. Thank you.

0 Kudos
Reply