How can I run jetson_clocks automatically after reboot every time?

How can I run jetson_clocks automatically after reboot every time?I would like to run max performance.

3 Likes

You can use systemd to do it.
Please refer to
https://devtalk.nvidia.com/default/topic/1000657/jetson-tx2/script-for-maximum-clockspeeds-and-performence/post/5241246/#5241246

please note that jetson_clocks is now placed in the PATH so we don’t need to specify absolute path but just “jetson_clocks”.

Hi,there.I have followed this,but it not worked.
On the AGX I created a startup service named jetsonClocks.service with the below lines of code in it and put it in etc/systemd/system folder:

[Unit]
Description=Maximize Jetson Performance
After=multi-user.target

[Service]
ExecStart=/bin/sh /home/sf/zqm/clocks.sh

[Install]
WantedBy=multi-user.target

In the clocks.sh file just put:

#!/bin/bash
# Maximize performance on the Jetson
# How long would this hold up in a long environment? No idea

sleep 6

jetson_clocks

exit 0

Then I run the following commands to enable the service

sudo chmod 644 /etc/systemd/system/jetsonClocks.service
sudo systemctl daemon-reload
sudo systemctl enable jetsonClocks.service
sudo reboot

But nothing happened.And I run

sudo clocks.sh

It worked that Maximize performance on the Jetson.

2 Likes

Not sure why but you can check the status of systemd by running

sudo systemctl status jetsonClocks.service

This worked fine for me

[Unit]
Description=Maximize Jetson Performance

[Service]
ExecStart=/usr/bin/jetson_clocks

[Install]
WantedBy=multi-user.target

Hi,there.I use your jetsonClocks.service file,and reboot my device.it doesn’t work,and the service status:

jetsonClocks.service - Maximize Jetson Performance
   Loaded: loaded (/etc/systemd/system/jetsonClocks.service; enabled; vendor preset: enabled)
   Active: inactive (dead) since Wed 2019-11-13 10:41:36 CST; 1min 7s ago
  Process: 4800 ExecStart=/usr/bin/jetson_clocks (code=exited, status=0/SUCCESS)
 Main PID: 4800 (code=exited, status=0/SUCCESS)

11月 13 10:41:35 sf-desktop systemd[1]: Starting Maximize Jetson Performance...
11月 13 10:41:36 sf-desktop systemd[1]: Started Maximize Jetson Performance.

after reboot,the jetson_clocks status:

SOC family:tegra194  Machine:Jetson-AGX
Online CPUs: 0-7
CPU Cluster Switching: Disabled
cpu0: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu1: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu2: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu3: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu4: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu5: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu6: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
cpu7: Online=1 Governor=schedutil MinFreq=1190400 MaxFreq=2265600 CurrentFreq=1190400 IdleStates: C1=0 c6=0
GPU MinFreq=318750000 MaxFreq=1377000000 CurrentFreq=318750000
EMC MinFreq=204000000 MaxFreq=2133000000 CurrentFreq=2133000000 FreqOverride=1
Fan: speed=255
NV Power Mode: MAXN

And I try to modify nvpmodel.service:

[Unit]
Description=nvpmodel service
; Everything depends on the NVIDIA per-boot script
After=nv.service
Requires=nv.service
; TPC power gating must be enabled before anything touching gpu
Before=graphical.target
Before=gdm3.service lightdm.service

[Service]
Type=simple
##################ExecStart=/usr/sbin/nvpmodel -f /etc/nvpmodel.conf
ExecStart=/usr/bin/jetson_clocks

[Install]
WantedBy=multi-user.target

and reboot ,it worked.I am confused that.

1 Like

You can also try the rc.local

https://linuxtechlab.com/executing-commands-scripts-at-reboot/