-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(gpu): add shared nvidia boost clock logic (#2014)
* Add shared nvidia boost clock logic * Use systemd unit for gpu clocks in al2 * Use ConditionPathExists to start unit
- Loading branch information
Showing
7 changed files
with
52 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Configure NVIDIA GPU clock rate | ||
After=nvidia-persistenced.service | ||
Requires=nvidia-persistenced.service | ||
|
||
ConditionPathExists=/usr/bin/nvidia-smi | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/bin/set-nvidia-clocks | ||
RemainAfterExit=true | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
# nvidia-smi is required for this script. | ||
if ! nvidia-smi -q > /tmp/nvidia-smi-check; then | ||
echo >&2 "ERROR: nvidia-smi check failed!" | ||
cat /tmp/nvidia-smi-check | ||
exit 1 | ||
fi | ||
|
||
# it's generally recommended to manually set clocks using max performance in | ||
# order to get predictable performance. | ||
# see: https://developer.nvidia.com/blog/advanced-api-performance-setstablepowerstate/ | ||
# see: https://developer.nvidia.com/blog/increase-performance-gpu-boost-k80-autoboost/ | ||
|
||
# persist device power states so that you dont incur long start up delay when | ||
# initializing new contexts on a CUDA GPU. | ||
sudo nvidia-smi --persistence-mode=1 | ||
|
||
# query the highest speed for both memory and graphics GPU clocks | ||
# NOTE: su permissions are not required for queries | ||
MEMORY_CLOCK=$(nvidia-smi --query-supported-clocks=memory --format=csv,noheader,nounits | head -n 1 | tr -d '\n') | ||
GRAPHICS_CLOCK=$(nvidia-smi --query-supported-clocks=graphics --format=csv,noheader,nounits | head -n 1 | tr -d '\n') | ||
|
||
# disable automatic clock boosts and specify desired maximum clock values | ||
sudo nvidia-smi --auto-boost-default=0 | ||
sudo nvidia-smi --applications-clocks ${MEMORY_CLOCK},${GRAPHICS_CLOCK} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters