Ask Your Question

How to enable the use of all the CPU cores

asked 2014-04-18 02:50:39 -0500

AlanMM gravatar image

Hi. I compiled OpenCV with Intel TBB support. I'm trying to use all my CPU cores (8) but when I check the task manager only 4 cores are working. In my code I use the function setNumThreads(8), and I see an improvement in speed without using it, but only 4 cores are working. Could someone tell me how could I enable the use of the 8 cores. Thanks.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-18 04:28:46 -0500

Try this:

// header files for TBB
#include <tbb\tbb_thread.h>
#include <tbb\blocked_range.h>
#include <tbb\parallel_for.h>
#include <tbb\parallel_reduce.h>
#include <tbb\task_scheduler_init.h>
#include <tbb\mutex.h>
#include <tbb\tbb_thread.h>
#include <tbb\blocked_range2d.h>

using namespace tbb;

// in main() function
int TBB_THREADS = 8;
task_scheduler_init init(TBB_THREADS);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools


Asked: 2014-04-18 02:50:39 -0500

Seen: 1,184 times

Last updated: Apr 18 '14