kfdtest: Improve finding rocm-smi

On Fedora, rocm-smi is a standard package and is installed to /usr/bin
So when run_kfdtest.sh is run this error is produced

find: ‘/opt/rocm*’: No such file or directory

First redirect stderr to dev/null on the original search.
Then fall back to either looking for rocm-smi in BIN_DIR or
look for it in the PATH.

Change-Id: I389ed0b9a4a4507263c9eb19894b25326c9a4222
Signed-off-by: Tom Rix <Tom.Rix@amd.com>
Signed-off-by: Jeremy Newton <Jeremy.Newton@amd.com>
This commit is contained in:
Tom Rix
2024-08-30 13:33:47 -07:00
committed by Kent Russell
parent 75143555fa
commit b9c6144f23
+10 -2
View File
@@ -277,8 +277,16 @@ while [ "$1" != "" ]; do
shift 1
done
# If the SMI is missing, just report and continue
SMI="$(find /opt/rocm* -type l -name rocm-smi | tail -1)"
# If the SMI is missing, try to find it
SMI="$(find /opt/rocm* -type l -name rocm-smi 2>/dev/null | tail -1)"
if [ -z ${SMI} ]; then
if [ -x ${BIN_DIR}/rocm-smi ]; then
SMI=${BIN_DIR}/rocm-smi
else
SMI=`which rocm-smi`
fi
fi
# If the SMI is still missing, just report and continue
if [ "$FORCE_HIGH" == "true" ]; then
if [ -e "$SMI" ]; then
OLDPERF=$($SMI -p | awk '/Performance Level:/ {print $NF; exit}')