How can i use 2 core on iMx6?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can i use 2 core on iMx6?

3,793 次查看
trongthinh
Contributor IV

Hi all,

I have an application that render image. When I run this app on PC and use htop to monitor CPU usage. I saw that 2 core were parallel used (because each core load about 30%). But when i run this app on iMX6 board and also use htop. I saw that 1 core load (100%) and the other (3%). I think it not good. Can anyone explain me the reason? Why does only one core work?

标签 (1)
标记 (3)
0 项奖励
10 回复数

2,254 次查看
KursadOney
NXP Employee
NXP Employee

Nobody can explain without knowing the details.

First make sure you are running on a multi-core mx6 and not one of mx6 solo, sololite, or soloX.

Second, check if all your CPUs are online:

cat /sys/devices/system/cpu/online

Third make sure your application spawns multiple threads that can run on multiple cores. See if there are multiple threads or not using htop.

Good luck.

0 项奖励

2,254 次查看
BiyongSUN
NXP Employee
NXP Employee

If you have taskset, you can assign program to a core.

And please check if the application using affinity to attach to a special core.

0 项奖励

2,254 次查看
trongthinh
Contributor IV

I use Qt (opensource) with QThread in my application. Qt doesn't provide

any method to assigned task to a specific core. So I think Qt handles

itself.

On Fri, Nov 20, 2015 at 12:33 PM, BiyongSUN <admin@community.freescale.com>

0 项奖励

2,254 次查看
KursadOney
NXP Employee
NXP Employee

When you launch htop, do you see multiple QT processes (threads) running and consuming the CPU or a single one? If it's a single one, then you compiled qthreads as a user space thread and the kernel cannot assign those to different cores. I'm not very familiar with Qthreads so I don't know how you'd map them to pthreads or similar.

If you see multiple QT threads, you can then assign them to different cores as Biyong said. Use the taskset command.

Also it's possible that you (or the thread library) is using OpenMP runtime extensions. Intel and ARM chips / compilers might behave differently based on their configuration.

0 项奖励

2,254 次查看
trongthinh
Contributor IV

Thank, the answer is nice. I also use pthread, the result is good: 2

core Load parallel. But on Qt App only one core full load, the other

(3%). I think the problem is QThread Class. Which parameter do i need to

reconfigure Qt and make QThread as a kernel thread? I can't found it on

google!

0 项奖励

2,254 次查看
KursadOney
NXP Employee
NXP Employee

Which version of QT are you using? Kernel threads should be the default after I think about 4.4.

0 项奖励

2,254 次查看
trongthinh
Contributor IV

I use Qt-everywhere-opensource (5.4.2).

0 项奖励

2,254 次查看
trongthinh
Contributor IV

1. I'm sure that my platform is iMX6 Dual-core.

2. I use command cat /sys/devices/system/cpu/online And i saw 2 CPU online.

it return 0-1

3. My application can create thread by click a button ( on click create 1

thread).

thank a lot for your help! And you recommend me shouldn't use htop for

monitor cpu usage, don't you?

On Thu, Nov 19, 2015 at 10:23 PM, KursadOney <admin@community.freescale.com>

0 项奖励

2,254 次查看
erickrieg
Contributor I

I have had a similar problem with the dual A7 core imx.7   I have a bare metal application that runs fine in 0 core - but can't even load in the second core.   It is my belief that something about how linux starts on the 0 core locks out the second core from being used at all.   The only discussion so far I can see of this syndrome is at : https://community.nxp.com/thread/398648    It seems strange that all that extra engineering and chip cost would have gone into having a second powerful A7 core - but there seems to be no example code or white paper on how to actually take advantage of it.    Perhaps there is or could be a specific linux build for the first core that could fully "own" and manage the second  - where maybe from the first core, there could be a service that allows code for a build for the second to be put in common memory and then the first core would unreset the second core and direct it to run a specific program.

0 项奖励

2,254 次查看
Yuri
NXP Employee
NXP Employee

Hello,

  I think it makes sense to create separate thread in Community regarding i.MX7

Regards,

Yuri.

0 项奖励