How to enable all cpu's by default?

Hi,

i’m having jetson tx2. After entering into working state only 4 cpu’s actively working remaining 2 cpu’s in inactive state.by using following cmd it’s enabled that is fine

echo 1 > /sys/devices/system/cpu/cpu1/online

But how to enable by defaul. For every time we have to enabled manually.Is it possible to enable automatically while from booting?

Thanks
Arun

Hi Arun, can you try running it as a startup script? These used to be out of /etc/rc.local but since Ubuntu 16.04, there is this workaround.

As suggested, I created a systemd unit file

[Service]
Type=oneshot
RemainAfterExit=true
StandardOutput=journal
ExecStart=/etc/rc-local.local
[Install]
WantedBy=multi-user.target

and script is (with chmod +s)

sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu1/online"
sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu2/online"
sudo /home/nvidia/jetson_clocks.sh

When tx2 restart unit runs normally and I can see that fan starts.


However, neither cores get enabled nor clocks. (check log below)

nvidia@tegra:~$ sudo systemctl status rc-local.service
● rc-local.service
Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: enabled)
Active: active (exited) since Mon 2018-11-05 17:31:42 PST; 33s ago
Process: 729 ExecStart=/etc/rc-local.local (code=exited, status=0/SUCCESS)
Main PID: 729 (code=exited, status=0/SUCCESS)
Tasks: 0
Memory: 0B
CPU: 0
CGroup: /system.slice/rc-local.service

Nov 05 17:31:41 tegra sudo[734]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo 1 > /sys/devices/system/cpu/cpu1/online
Nov 05 17:31:41 tegra sudo[734]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 05 17:31:41 tegra sudo[734]: pam_unix(sudo:session): session closed for user root
Nov 05 17:31:41 tegra sudo[742]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/sh -c echo 1 > /sys/devices/system/cpu/cpu2/online
Nov 05 17:31:41 tegra sudo[742]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 05 17:31:41 tegra sudo[742]: pam_unix(sudo:session): session closed for user root
Nov 05 17:31:41 tegra sudo[744]: root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/home/nvidia/jetson_clocks.sh
Nov 05 17:31:41 tegra sudo[744]: pam_unix(sudo:session): session opened for user root by (uid=0)
Nov 05 17:31:42 tegra sudo[744]: pam_unix(sudo:session): session closed for user root
Nov 05 17:31:42 tegra systemd[1]: Started rc-local.service.

nvidia@tegra:~$ /home/nvidia/tegrastats
RAM 998/7846MB (lfb 1536x4MB) CPU [0%@345,off,off,0%@345,0%@345,0%@345] BCPU@34C MCPU@34C GPU@33C PLL@34C Tboard@32C Tdiode@31.25C PMIC@100C thermal@33.6C VDD_IN 3050/3050 VDD_CPU 152/152 VDD_GPU 152/152 VDD_SOC 838/838 VDD_WIFI 19/19 VDD_DDR 1262/1262
RAM 998/7846MB (lfb 1536x4MB) CPU [2%@345,off,off,1%@345,1%@345,6%@345] BCPU@34C MCPU@34C GPU@33C PLL@34C Tboard@32C Tdiode@31C PMIC@100C thermal@33.6C VDD_IN 3050/3050 VDD_CPU 152/152 VDD_GPU 152/152 VDD_SOC 838/838 VDD_WIFI 38/28 VDD_DDR 1262/1262

nvidia@tegra:~ sudo systemctl restart rc-local.service </b> nvidia@tegra:~ /home/nvidia/tegrastats
RAM 1007/7846MB (lfb 1521x4MB) CPU [0%@2035,0%@2035,0%@2035,0%@2035,0%@2035,0%@2035] BCPU@33C MCPU@33C GPU@32C PLL@33C Tboard@30C Tdiode@29.75C PMIC@100C thermal@32.3C VDD_IN 2554/2554 VDD_CPU 381/381 VDD_GPU 152/152 VDD_SOC 610/610 VDD_WIFI 19/19 VDD_DDR 822/822
RAM 1007/7846MB (lfb 1521x4MB) CPU [1%@2035,0%@2035,0%@2035,1%@2035,0%@2035,0%@2035] BCPU@33C MCPU@33C GPU@32C PLL@33C Tboard@30C Tdiode@29.75C PMIC@100C thermal@32.1C VDD_IN 2554/2554 VDD_CPU 381/381 VDD_GPU 152/152 VDD_SOC 610/610 VDD_WIFI 19/19 VDD_DDR 822/822

Does it require a user session. I tried to create a systemd unit file with --user option, yet clocks and cores are not update. What am I missing?

FYI, no session should be required for this.

I haven’t tested, but perhaps it is just how it is quoted. I suspect this is wrong:

sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu1/online"
sudo sh -c "echo 1 > /sys/devices/system/cpu/cpu2/online"

Try instead:

<s>sudo</s> sh -c 'echo 1' > '/sys/devices/system/cpu/cpu1/online'
<s>sudo</s> sh -c 'echo 1' > '/sys/devices/system/cpu/cpu2/online'

Basically it looks like the echo and the redirect are one command in your version, but in reality only the echo is a command, and the redirect is a second command. By quoting it as one line I suspect it thinks the redirect location is an argument and not a redirect.

I use single quotes just out of caution…double quotes could be substituted and you want this to be literal. This particular command should never be substituted even for what you have, but I consider it a good habit to use the double quote only if I actually intend to substitute.

Also, it was pointed out to me that “sudo” would only apply to the first part if I did it this way…but the rc.local and other init scripts are already run as root, so sudo should be removed.

I’ve exactly the same problem, but the quoted hint doesn’t help.
systemd service:

[Unit]
Description=Activate Jetson Denver Cores
[Service]
ExecStart=/opt/bin/jetson_denver.sh
Type=simple
User=root
Group=sudo
[Install]
WantedBy=multi-user.target

/opt/bin/jetson_denver.sh

#!/bin/bash
sh -c 'echo 1' > '/sys/devices/system/cpu/cpu1/online'
sh -c 'echo 1' > '/sys/devices/system/cpu/cpu2/online'

I could fix this by using

nvpmodel -m 0

instead of the commands above.

Yes, since this topic was originally posted, the nvpmodel tool was released in JetPack, which can specify the online CPU cores and automatically activates the user’s desired nvpmodel profile at boot.

Does this mean, no custom service stated at boot is needed anymore?

That’s correct, instead it’s recommended to set your desired nvpmodel (which will persist after reboot). You can also edit or create your own nvpmodel definitions found in /etc/nvpmodel.conf

I have the same issue. its 2020 and nobody found a solution for this?

tx2 has 6 cores but 2 of them sit at 0% usage all the time. Regardless if you run nvpmodel -m 0 or jetson_clocks.sh run enter echo 1 > /sys/devices/system/cpu/cpu5/online for all the cores.

I’m having the same issue. Running Jetpack 4.4.1 and compiling some code examples with make -j6 only maxes out 4 of the cores, the other 2 cores sit idle. No settings in jtop seems to fix the issue, despite all 6 cores showing active and available when running lscpu.

See:
https://forums.developer.nvidia.com/t/jetson-tx2-has-2-cpu-online-but-sitting-at-0/159311/2

I’ll give that a shot, thanks for the tip! I will followup with the results.