CPU Parallelism in Dragonboard 410c


#1

Hello ,

I have a dragonboard 410C with debian os.
I want to run a simple application (ex: Hello World) using the 4 cores of the CPU at the same time. how to do it ?
I’d like to know if this possible with symphony or I need to use an other SDK ?

Thank you in advance for your help.


#2

it’s just Linux :wink:

you can run any Linux application on your board. There are many different ways you can do multi thread programming.

Just found this very simple example that will just works on your board:

https://computing.llnl.gov/tutorials/pthreads/samples/hello.c


#3

Arguably parallelism is a technique, not a goal in itself. Thus the best way to exploit the cores depends upon the problem you are trying to solve.

In regular Linux you can use the normal API to spawn off additional threads (pthread_create() ) although if you are planning to go on to write parallel algorithms you might prefer to adopt a framework or language that automatically manages a thread pool for you.


#4

Thank you ndec and danielt for your help, the example works successfully!
I know that parallelism is a technique, but I’m still figuring out this board and I want to learn all the possibles techniques.
I have another question,How can I code the GPU ?


#5

Just one point I would add to this, since the question specifically mentioned spreading the load over all the CPU cores… despite the multiple threads, it does not actually mean that they will be spread over all the CPU cores, since that job is left up to the kernel to decide how best to distribute resources.

@Ibtissam_serbouti : when the actual workload of the various threads starts to consume significant CPU resources (the example is trivial and the workload from actually switching the threads to other CPU cores would vastly exceed the actual job being performed), the kernel will move them around to other cores in order to achieve the objectives it is configured for, which could be to maximize performance, minimize power consumption, or some balance of each.


#6

The pthread_setaffinity_np() function can be used to define on which cpu(s) to run the threads, allowing to spread them over the cores. Can be used for testing purpose (not easily portable and probably a good idea to let the kernel scheduler doing its job).