Off load task from CPU to GPU

Hello, I was trying to get dual camera access on my jetson Nano B01 board. I got the access and it’s perfectly synchronized, but I got that all the 4 CPU cores works maximisely and I don’t want to push cpu cores this much heavy. So does anyone know how to offload the task from CPU to GPU.? Thanks in advance…!

What’s dua camera access?

sorry it’s dual camera

The CPU usage depend on the sensor resolution and frame rate.
What your use case?

We are using Arducam IMX219 https://robu.in/product/arducam-imx219-wide-angle-camera-module-for-nvidia-jetson-nano-raspberry-pi/

What’s you command line to launch camera?

gstreamer

gst-launch-1.0 -e nvarguscamerasrc ! 'video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12, framerate=30/1' ! tee name=streams streams. ! queue ! nvv4l2h264enc bitrate=8000000 ! h264parse ! queue ! qtmux ! filesink location=$FILE_A streams. ! queue ! nvv4l2h264enc bitrate=8000000 ! h264parse ! queue ! qtmux ! filesink location=$FILE_B

We generated a python code so as to work two cameras with perfect synchronizations

How do you check the CPU usage?

sudo jtop and nsight system profiler

1 Like

I get below result by run your command. And top show about 26% of cpu usage of 4 cpu cores.

RAM 1815/3956MB (lfb 114x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [14%@921,14%@921,15%@921,8%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@26C PMIC@50C GPU@24.5C AO@30.5C thermal@25.5C POM_5V_IN 3213/3213 POM_5V_GPU 0/0 POM_5V_CPU 417/417
RAM 1817/3956MB (lfb 113x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [15%@921,11%@921,13%@921,13%@921] EMC_FREQ 10%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@25.5C PMIC@50C GPU@24.5C AO@31C thermal@25.5C POM_5V_IN 2846/3029 POM_5V_GPU 41/20 POM_5V_CPU 334/375
RAM 1818/3956MB (lfb 110x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [18%@921,16%@921,17%@921,14%@921] EMC_FREQ 10%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@30.5C thermal@25.25C POM_5V_IN 3176/3078 POM_5V_GPU 0/13 POM_5V_CPU 417/389
RAM 1818/3956MB (lfb 109x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [14%@921,12%@921,15%@921,10%@921] EMC_FREQ 10%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@25.5C PMIC@50C GPU@24.5C AO@30.5C thermal@25.25C POM_5V_IN 2846/3020 POM_5V_GPU 0/10 POM_5V_CPU 376/386
RAM 1818/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [14%@921,13%@921,12%@921,12%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@30.5C thermal@25.25C POM_5V_IN 2804/2977 POM_5V_GPU 0/8 POM_5V_CPU 376/384
RAM 1811/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [19%@921,16%@921,22%@921,9%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@25.5C PMIC@50C GPU@25C AO@31C thermal@25.25C POM_5V_IN 2925/2968 POM_5V_GPU 0/6 POM_5V_CPU 376/382
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [15%@921,11%@921,11%@921,11%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@25.5C PMIC@50C GPU@24.5C AO@31C thermal@25.5C POM_5V_IN 2804/2944 POM_5V_GPU 0/5 POM_5V_CPU 376/381
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [17%@921,16%@921,11%@921,12%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@26C PMIC@50C GPU@24.5C AO@31C thermal@25.5C POM_5V_IN 2925/2942 POM_5V_GPU 0/5 POM_5V_CPU 417/386
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [17%@921,14%@921,12%@921,11%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@22.5C CPU@26C PMIC@50C GPU@24.5C AO@31C thermal@25.25C POM_5V_IN 2846/2931 POM_5V_GPU 0/4 POM_5V_CPU 376/385
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [17%@921,14%@921,15%@921,9%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@31C thermal@25.25C POM_5V_IN 2929/2931 POM_5V_GPU 0/4 POM_5V_CPU 376/384
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [19%@921,15%@921,14%@921,7%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@31C thermal@25.25C POM_5V_IN 2804/2919 POM_5V_GPU 0/3 POM_5V_CPU 376/383
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [13%@921,12%@921,12%@921,7%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@31C thermal@25C POM_5V_IN 2888/2917 POM_5V_GPU 0/3 POM_5V_CPU 376/382
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [13%@921,14%@921,14%@921,6%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@26C PMIC@50C GPU@25C AO@31C thermal@25.5C POM_5V_IN 2929/2918 POM_5V_GPU 0/3 POM_5V_CPU 376/382
RAM 1810/3956MB (lfb 107x4MB) SWAP 0/1978MB (cached 0MB) IRAM 0/252kB(lfb 252kB) CPU [12%@921,14%@921,11%@921,11%@921] EMC_FREQ 11%@1600 GR3D_FREQ 0%@76 NVENC 268 APE 25 PLL@23C CPU@25.5C PMIC@50C GPU@25C AO@31C thermal@25.25C POM_5V_IN 2888/2915 POM_5V_GPU 0/2 POM_5V_CPU 417/384

We are running this dual camera code in a frame sequential manner

I run two camera get about 52% + 18% +18 % CPU usage. And about 13% + 4.9% +4.7% whole system(4 cores) press shift + i to switch the Irix mode.

Irix mode on

Tasks: 314 total,   1 running, 312 sleeping,   0 stopped,   1 zombie
%Cpu(s): 13.1 us, 12.4 sy,  0.0 ni, 72.7 id,  0.0 wa,  1.0 hi,  0.8 si,  0.0 st
KiB Mem :  3921020 total,   965984 free,  1900768 used,  1054268 buff/cache
KiB Swap:  1960496 total,  1960496 free,        0 used.  1820336 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND
 5415 root      20   0 10.291g 236084  37388 S  52.5  6.0   0:34.69 nvargus-daemon
 8297 nvidia    20   0 9579376  58708  28452 S  18.5  1.5   0:14.23 gst-launch-1.0
 8679 nvidia    20   0 9577916  57112  28516 S  18.2  1.5   0:10.20 gst-launch-1.0
Irix mode off
Tasks: 306 total,   2 running, 303 sleeping,   0 stopped,   1 zombie
%Cpu(s): 13.5 us, 12.9 sy,  0.0 ni, 71.9 id,  0.0 wa,  1.0 hi,  0.8 si,  0.0 st
KiB Mem :  3921020 total,   784084 free,  1910268 used,  1226668 buff/cache
KiB Swap:  1960496 total,  1959220 free,     1276 used.  1794140 avail Mem

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND
 5415 root      20   0 10.291g 246400  37412 S 13.1  6.3   2:34.20 nvargus-daemon
 8679 nvidia    20   0 9578240  57200  28268 S  4.9  1.5   0:52.00 gst-launch-1.0
 8297 nvidia    20   0 9579692  58776  28180 S  4.7  1.5   0:57.06 gst-launch-1.0

what is this irix mode in nano? will it make efficient in dual camera streaming and processings.?

It’s for multiple CPUs usage calculation.

So what should we need to do?

If you got the same result then it already the optimize.

How can we shift to Irix mode and back.

Press shift + i again

Irix mode on

Irix mode off

Looks like the python use much more CPU source.
The nvargus-daemon is as expect.