TX2, CPU spec details and multi-thread

  1. For tx2, there are 6 CPUs, how can I get the detailed information about each CPU?

  2. Now my code have 5 threads(including 1 main thread and 4 sub threads), when I created these 5 threads, it was allocated to different CPUs automatically by Jetson. How can I allocate all 5 threads to the 1 most powerful CPU, since all 5 threads need to share some memory consistently, it will take some time for data copying between CPUs, while if I allocate all threads on 1 CPU, data copying data is saved.

Is 5 threads too much for 1 CPU, I remember it’s quad-core CPU.


It may depend on what information you want, but have you seen:

cat /proc/cpuinfo

(if not in some energy saving mode this will have 6 CPUs, two of which are Denver cores)

I tend to monitor what goes on via htop (“sudo apt-get install htop”).

Setting CPU affinity would depend on where you want to set it, e.g., from a C/C++ program versus command line. More information is needed.

Setting affinity to any core other than CPU0 will not work if hardware I/O is involved (some parts of I/O may work on other cores, but hardware IRQs…versus software IRQs…will always go to CPU0). The memory controller is of course available to all cores.

If you are looking at cache performance involving the GPU (or CUDA) it probably gets a lot more complicated and would need someone else to comment.

  1. I will use it from a C/C++ program not command line, any suggestion?
  2. CPU0 can be allocated to hardware I/O, others CPUs can be allocated to other threads, is it doable?

Imagine GPIO is a physical wire. It is more than virtual, an actual electrical signal must touch whatever CPU is looking at the GPIO. In a desktop PC you might have something like a an I/O APIC to redistribute requests to whichever core is available to service it. In the case of this ARM hardware I know of no way to route the physical status of the GPIO to any core other than CPU0. No wire to other cores, no chance of other cores handling this. One can check the GPIO status on one core, and then use the results on another core, but another core will never be able to directly find the status of a wire it can’t touch.

This reply is actually how to access the functionality programmatically, not via command line (the manual page is visible from command line, the actual information is not about command line):

“Boost” is a popular library for wrapping such functionality, but the C API version should be available without special wrapper libraries. Newer C++ standards may implement threading related functionality as well, but the named C API is always going to be there even with older compilers.