Forums - SNPE cpu inference number of threads

2 posts / 0 new
Last post
SNPE cpu inference number of threads
akelly
Join Date: 15 Jan 19
Posts: 1
Posted: Fri, 2019-02-22 02:19

Hi,

I am using SNPE for NN inference on a Snapdragon 845 running Android P. Both gpu and dsp performance is good, however, cpu performance is poor. I have determined that the number of threads launched is the cause of poor cpu performance - snpe uses all available cores. Using 8 cores, I can infer 8 images per second, however, when I disactivate 7 of the 8 cpu cores (keeping an A75), I can infer 35 images per second. As well as having increased performance on one core, I would like to keep the other cpu cores free for other tasks. Is it possible to manually specify the number of threads via the snpe C++ api?

Thanks

  • Up0
  • Down0
gesqdn-forum
Join Date: 4 Nov 18
Posts: 184
Posted: Wed, 2019-06-12 22:36

Hi,

This issue can be addressed based on the concepts in parallel processing.Threads use rand() and rand_r() function to generate random numbers. rand_r() is thread safe while rand() is not.The function rand() internally has its own mutex locking which may causing this slowdown. 

   And yes, we can control/specify the number of threads using vectors in C++. I would suggest you to follow this link(https://unix.stackexchange.com/questions/444653/why-is-my-program-slower-despite-using-more-threads) which has a similar issue.But I'm not sure whether SNPE has this support.

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.