I'm using OpenTLD (that uses OpenCV for image analysis) in a Raspberry Pi 2 project for object tracking. In order to combat lag issues (about 3 seconds of video lag) I enabled OpenMP support when I compiled. Now, I get only about 2 seconds of lag. Running top
tells me that at most only ~170% CPU is being used by opentld
, leading me to suspect that OpenMP is using only two of the Raspberry Pi 2's four cores.
From what I understand of this Wikipedia diagram, OpenMP should be able to utilize all four cores. Is this a matter of OpenMP not recognizing all the cores, or is it something else?
First of all, you should do export OMP_NUM_THREADS=4
on the console.
Top reporting usages of 170% for the CPU, doesn't necessarily mean you're only running with 2 threads. The code might be memory bound and that might also deliver low CPU usage levels.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With