task_scheduler_init does not obey number_of_threads parameter in debug mode

task_scheduler_init does not obey number_of_threads parameter in debug mode


I've been having a weird issue for a while with TBB. Even with the latest Windows x64 binaries (tbb40_297oss), in debug mode when I create my task_scheduler_init object by setting the number_of_threads parameter to 1, my program still runs in many threads with parallel_for. In release mode, it seems to spawn one thread, cause my Core i7 CPU is loaded on 1/8. In debug it's fully loaded and jumps across threads when debugging. And I want to debug with a single thread. Any ideas?


6 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I've just tested with the latest tbb40_20120408oss (aligned with TBB 4.0 update 4). All works correct, I don't see the issue. If Intel TBB is built in Debug mode when I initialize task_scheduler_init to 1 thread it creates only 1 thread. I've check number of threads with Intel VTune Amplifier XE.

Thanks for the reply. I'll investigate and try to prepare and share a small example, if I cannot resolve the problem.

This is a follow up: Did you resolve the problem?

Hi, I am now facing a similar problem. The number of threads I designate in task_scheduler_init does not conform what Intel Vtune Amplifier XE shows.
Here is the difference:
task_scheduler_init threads count in Intel Vtune Amplifier
1 1
2 3
3 5
4 6
5 7
6 8
7 9

And I have another question. Somebody say that set __TBB_ARENA_PER_MASTER to 0 would help. But I can not find this var. I searched the file in /usr/include/tbb/tbb_config.h My tbb is installed from Synaptic and is 3.0+r147.

Hoping to get messages. Thanks!

Could you please attach a code sample representing this behavior?

Leave a Comment

Please sign in to add a comment. Not a member? Join today