Look in /opt/rocm* for SMI for setting clocks to high

Now that symlinks aren't necessarily guaranteed, use "find" to try to
find the rocm-smi, and clarify the error message if it is not found

Also tie in a fix for parsing the output now that the output has changed

Change-Id: I2081442a71731c186c3ad00585a2ba6e8a8e5a28


[ROCm/ROCR-Runtime commit: 2651ce37d8]
Tento commit je obsažen v:
Kent Russell
2020-11-23 08:38:02 -05:00
rodič 0e2e1aca74
revize e39dab44e3
+6 -5
Zobrazit soubor
@@ -244,16 +244,17 @@ while [ "$1" != "" ]; do
done
# If the SMI is missing, just report and continue
SMI="$(find /opt/rocm* -type l -name rocm-smi | tail -1)"
if [ "$FORCE_HIGH" == "true" ]; then
if [ -e "/opt/rocm/bin/rocm-smi" ]; then
OLDPERF=$(/opt/rocm/bin/rocm-smi -p | awk '/Performance Level/ {print $NF; exit}')
$(/opt/rocm/bin/rocm-smi --setperflevel high &> /dev/null)
if [ -e "$SMI" ]; then
OLDPERF=$($SMI -p | awk '/Performance Level:/ {print $NF; exit}')
$($SMI --setperflevel high &> /dev/null)
if [ $? != 0 ]; then
echo "SMI failed to set perf level"
OLDPERF=""
fi
else
echo "Unable to set clocks to high"
echo "Unable to set clocks to high, cannot find rocm-smi"
fi
fi
@@ -263,5 +264,5 @@ runKfdTest
# OLDPERF is only set if FORCE_HIGH and SMI both exist
if [ -n "$OLDPERF" ]; then
/opt/rocm/bin/rocm-smi --setperflevel $OLDPERF &> /dev/null
$SMI --setperflevel $OLDPERF &> /dev/null
fi