From 471e055ca5a9525b2c2f6b7787d3b24d4cd7022e Mon Sep 17 00:00:00 2001 From: Josh Lay Date: Thu, 3 Nov 2022 20:09:52 -0500 Subject: [PATCH] properly select the highest connected GPU --- playbook.yml | 2 +- templates/amdgpu-clock.sh.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/playbook.yml b/playbook.yml index 47f3e99..4a5a82d 100644 --- a/playbook.yml +++ b/playbook.yml @@ -42,7 +42,7 @@ when: (fed_ppdtuned_swap is not defined) or ('tuned' not in ansible_facts.packages) - name: determine GPU device in drm subsystem shell: - cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | tail -1 + cmd: grep -ls ^connected /sys/class/drm/*/status | grep -o card[0-9] | sort | uniq | sort -h | tail -1 executable: /bin/bash changed_when: false register: card diff --git a/templates/amdgpu-clock.sh.j2 b/templates/amdgpu-clock.sh.j2 index 918eb5a..9be91f4 100644 --- a/templates/amdgpu-clock.sh.j2 +++ b/templates/amdgpu-clock.sh.j2 @@ -16,7 +16,7 @@ {# done this way to avoid issues with the card number possibly shifting after playbook run #} # dynamically determine the connected GPU using the DRM subsystem -CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o 'card[0-9]' | /usr/bin/sort | /usr/bin/uniq | /usr/bin/tail -1) +CARD=$(/usr/bin/grep -ls ^connected /sys/class/drm/*/status | /usr/bin/grep -o 'card[0-9]' | /usr/bin/sort | /usr/bin/uniq | /usr/bin/sort -h | /usr/bin/tail -1) {# begin the templated script for 'default' profiles to reset state #} {% if 'default' in item.0.key %}