task_scheduler_init::default_num_threads() returns 1

task_scheduler_init::default_num_threads() returns 1

I'm using a Core i7-6700 CPU. Why does tbb create only one thread by default?

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

I suppose it is caused by the affinity mask of the calling thread. task_scheduler_init respects the affinity mask of the calling thread and, if only one bit is set, it can return 1. Do you use other threading models inside your application? Try to call task_scheduler_init::default_num_threads in the beginning of the main function. However, the affinity mask can be set externally, e.g. with the taskset utility. What OS do you use and how the application is launched? 

Quote:

Alex (Intel) wrote:

I suppose it is caused by the affinity mask of the calling thread. task_scheduler_init respects the affinity mask of the calling thread and, if only one bit is set, it can return 1. Do you use other threading models inside your application? Try to call task_scheduler_init::default_num_threads in the beginning of the main function. However, the affinity mask can be set externally, e.g. with the taskset utility. What OS do you use and how the application is launched? 

Hi Alex,

This problem is indeed caused by another library I use, namely dlib.

I'm using Arch Linux so I used the package on AUR. It constraints all the threads to only one core.

However, when I compiled dlib from source, the problem disappears.

Leave a Comment

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