How TO Using Multiple CPU Parallel

I flash Hikey 970 with (LeMaker Ubuntu)], when i run a python task, i run top command, i found that only one CPU was used, and others CPU were idle. And i test other computing task the result is the same. Is there any way to let the CPUs run the task parallel automaticly?
And how i can use the NPU HiKey 970 has in this ubuntu system?

In order for your program to utilize multiple CPU cores, you need to write it to do so.
You can use threading, or you can use multiple processes.

Here is for threading;
https://www.tutorialspoint.com/python/python_multithreading.htm

For multiple processes, the simplest way to implement this is to start multiple processes separately from the commandline, but more likely, you want a single started process to fork additional processes, and for those individual processes to be able to communicate (called Inter-Process Communication, or IPC).

I don’t advocate those particular links, but they came up in a quick google search.

1 Like

Thank you for your reply ! There i have another question why i run the same task in device intel NUC(x86 architecture) , and it can use mutiple CPU automatically. Is it beacuse architecture NUC is x86 and Hikey 970 is arm ?

doitright via 96Boards Forum noreply@discuss.96boards.org 于2019年3月14日周四 下午10:38写道:

I think you will have to explain what workload you are running and how
you are measuring how that workload has spread across the CPUs. On
machines with few cores (dual core is especially prone to this) then
background activity makes is look like the workload is more parallel than
it is in reality.

So what are you running and how are you measuring the parallelism?

Oh… and what NUC is it? In particular if it implements hyperthreading
it may also appear more parallel than it is in reality.

Daniel.