kfdtest: Add run utility files for kfdtest
A README.txt file is added to help the opensource community to use kfdtest effectively. After building, run_kfdtest.sh in the building output folder can be used to run the test. Change-Id: I9612d9d5a63bd4cdc3a328efd9961d3cc92a6ba5 Signed-off-by: Yong Zhao <yong.zhao@amd.com>
Este cometimento está contido em:
@@ -106,3 +106,5 @@ add_executable(kfdtest ${SRC_FILES})
|
||||
|
||||
target_link_libraries(kfdtest ${HSAKMT_LIBRARIES} ${DRM_LIBRARIES} ${DRM_AMDGPU_LIBRARIES} pthread m stdc++ rt amdsp3)
|
||||
|
||||
configure_file ( scripts/kfdtest.exclude kfdtest.exclude COPYONLY )
|
||||
configure_file ( scripts/run_kfdtest.sh run_kfdtest.sh COPYONLY )
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
1. Note on building kfdtest
|
||||
|
||||
To build this kfdtest application, the following libraries should be already
|
||||
installed on the building machine:
|
||||
libdrm libdrm_amdgpu libhsakmt
|
||||
|
||||
If libhsakmt is not installed, but the headers and libraries are present
|
||||
locally, you can specify its directory by
|
||||
export LIBHSAKMT_PATH=/*your local libhsakmt folder*/
|
||||
With that, the headers and libraries are searched under
|
||||
LIBHSAKMT_PATH/include and LIBHSAKMT_PATH/lib respectively.
|
||||
|
||||
|
||||
2. How to run kfdtest
|
||||
|
||||
Just run "./run_kfdtest.sh" under the building output folder. You may need
|
||||
to specify library path through:
|
||||
export LD_LIBRARY_PATH=/*your library path containing libhsakmt*/
|
||||
|
||||
Note: you can use "run_kfdtest.sh -h" to see more options.
|
||||
Ficheiro executável
+217
@@ -0,0 +1,217 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (C) 2018 Advanced Micro Devices, Inc. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
# OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
#
|
||||
|
||||
|
||||
if [ "$BIN_DIR" == "" ]; then
|
||||
BIN_DIR="$(pwd)/$(dirname $0)"
|
||||
fi
|
||||
|
||||
PLATFORM=""
|
||||
GDB=""
|
||||
NODE=""
|
||||
MULTI_GPU=""
|
||||
FORCE_HIGH=""
|
||||
|
||||
printUsage() {
|
||||
echo
|
||||
echo "Usage: $(basename $0) [options ...] [gtest arguments]"
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " -p <platform> , --platform <platform> Only run tests that"\
|
||||
"pass on the specified platform"
|
||||
echo " -g , --gdb Run in debugger"
|
||||
echo " -n , --node NodeId to test. If"\
|
||||
"not specified test will be run on all nodes"
|
||||
echo " -l , --list List available nodes"
|
||||
echo " --high Force clocks to high for test execution"
|
||||
echo " -h , --help Prints this help"
|
||||
echo
|
||||
echo "Gtest arguments will be forwarded to the app"
|
||||
echo
|
||||
echo "Valid platform options: cz, kv, tg, fj, hi, pl/el, plb/bf, vg10, all"
|
||||
echo "'all' option runs all tests"
|
||||
|
||||
return 0
|
||||
}
|
||||
# Print gtest_filter for the given Platform
|
||||
# If MULTI_GPU flag is set, then Multi-GPU Tests are selected. Once all tests
|
||||
# pass in Multi GPU environment, this flag can be removed
|
||||
# param - Platform.
|
||||
getFilter() {
|
||||
local platform=$1;
|
||||
case "$platform" in
|
||||
cz ) FILTER="--gtest_filter=$CZ_TESTS_BLACKLIST" ;;
|
||||
hi ) FILTER="--gtest_filter=$HI_TESTS_BLACKLIST" ;;
|
||||
kv ) FILTER="--gtest_filter=$KV_TESTS_BLACKLIST" ;;
|
||||
tg ) FILTER="--gtest_filter=$TONGA_TESTS_BLACKLIST" ;;
|
||||
fj ) FILTER="--gtest_filter=$FIJI_TESTS_BLACKLIST" ;;
|
||||
pl | el ) FILTER="--gtest_filter=$ELLESMERE_TESTS_BLACKLIST" ;;
|
||||
plb | bf ) FILTER="--gtest_filter=$BAFFIN_TESTS_BLACKLIST" ;;
|
||||
vg10 ) FILTER="--gtest_filter=$VEGA10_TESTS_BLACKLIST" ;;
|
||||
vg20 ) FILTER="--gtest_filter=$VEGA20_TESTS_BLACKLIST" ;;
|
||||
rv ) FILTER="--gtest_filter=$RAVEN_TESTS_BLACKLIST" ;;
|
||||
all ) FILTER="" ;;
|
||||
*) die "Unsupported platform $PLATFORM or node $NODE. Exiting" ;;
|
||||
esac
|
||||
echo "$FILTER"
|
||||
}
|
||||
|
||||
TOPOLOGY_SYSFS_DIR=/sys/devices/virtual/kfd/kfd/topology/nodes
|
||||
|
||||
# Prints list of HSA Nodes. HSA Nodes are identified from sysfs KFD topology. The nodes
|
||||
# should have valid SIMD count
|
||||
getHsaNodes() {
|
||||
for i in $(find $TOPOLOGY_SYSFS_DIR -maxdepth 1 -mindepth 1 -type d); do
|
||||
simdcount=$(cat $i/properties | grep simd_count | awk '{print $2}')
|
||||
if [ $simdcount != 0 ]; then
|
||||
hsaNodeList+="$(basename $i) "
|
||||
fi
|
||||
done
|
||||
echo "$hsaNodeList"
|
||||
}
|
||||
|
||||
|
||||
# Prints GPU name for a given Device ID
|
||||
# param - Device ID.
|
||||
deviceIdToGpuName() {
|
||||
local deviceId=$1; shift;
|
||||
case $deviceId in
|
||||
1304 | 1305 | 1306 | 1307 | 1309 | 130a | 130b | 130c | 130d | 130e | 130f | \
|
||||
1310 | 1311 | 1312 | 1313 | 1315 | 1316 | 1317 | 1318 | 131b | 131c | 131d )
|
||||
platformName="kv" ;;
|
||||
67a0 | 67a1 | 67a2 | 67a8 | 67a9 | 67aa | 67b0 | 67b1 | 67b8 | 67b9 | 67ba | 67be )
|
||||
platformName="hi" ;;
|
||||
9870 | 9874 | 9875 | 9876 | 9877 )
|
||||
platformName="cz" ;;
|
||||
6920 | 6921 | 6928 | 6929 | 692b | 692f | 6930 | 6938 | 6939 )
|
||||
platformName="tg" ;;
|
||||
7300 | 730f)
|
||||
platformName="fj" ;;
|
||||
67c0 | 67c1 | 67c2 | 67c4 | 67c7 | 67c8 | 67c9 | 67ca | 67cc | 67cf | 67d0 | 67df )
|
||||
platformName="pl" ;;
|
||||
67e0 | 67e1 | 67e3 | 67e7 | 67e8 | 67e9 | 67eb | 67ef | 67ff )
|
||||
platformName="plb" ;;
|
||||
6860 | 6861 | 6862 | 6863 | 6864 | 6867 | 6868 | 6869 | 686a | 686b | 686c | 687f)
|
||||
platformName="vg10" ;;
|
||||
66a0 | 66a1 | 66a2 | 66a3 |66a7 | 66af)
|
||||
platformName="vg20" ;;
|
||||
15dd )
|
||||
platformName="rv" ;;
|
||||
* )
|
||||
return ;;
|
||||
esac
|
||||
echo "$platformName"
|
||||
}
|
||||
|
||||
|
||||
# Prints GPU Name for the given Node ID
|
||||
# param - Node ID
|
||||
getNodeName() {
|
||||
local nodeId=$1; shift;
|
||||
local gpuIdInDec=$(cat $TOPOLOGY_SYSFS_DIR/$nodeId/properties | grep device_id | awk '{print $2}')
|
||||
printf -v gpuIdInHex "%x" "$gpuIdInDec"
|
||||
local gpuName=$(deviceIdToGpuName $gpuIdInHex)
|
||||
echo "$gpuName"
|
||||
}
|
||||
|
||||
# Run KfdTest independently. Two global variables set by command-line
|
||||
# will influence the tests as indicated below
|
||||
# PLATFORM - If set all tests will run with this platform filter
|
||||
# NODE - If set tests will be run only on this NODE, else it will be
|
||||
# run on all available HSA Nodes
|
||||
runKfdTest() {
|
||||
if [ "$NODE" == "" ]; then
|
||||
hsaNodes=$(getHsaNodes)
|
||||
else
|
||||
hsaNodes=$NODE
|
||||
fi
|
||||
|
||||
source $BIN_DIR/kfdtest.exclude
|
||||
|
||||
for hsaNode in $hsaNodes; do
|
||||
nodeName=$(getNodeName $hsaNode)
|
||||
if [ "$PLATFORM" != "" ] && [ "$PLATFORM" != "$nodeName" ]; then
|
||||
echo "WARNING: Actual ASIC $nodeName treated as $PLATFORM"
|
||||
nodeName="$PLATFORM"
|
||||
fi
|
||||
|
||||
gtestFilter=$(getFilter $nodeName)
|
||||
|
||||
echo ""
|
||||
echo "++++ Starting testing node $hsaNode ($nodeName) ++++"
|
||||
$GDB $KFDTEST "--node=$hsaNode" $gtestFilter $GTEST_ARGS
|
||||
echo "---- Finished testing node $hsaNode ($nodeName) ----"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
# Prints number of GPUs present in the system
|
||||
getGPUCount() {
|
||||
gNodes=$(getHsaNodes)
|
||||
gNodes=( $gNodes )
|
||||
gpuCount=${#gNodes[@]}
|
||||
echo "$gpuCount"
|
||||
}
|
||||
|
||||
# set $MULTI_GPU flag if the system has more than 1 GPU
|
||||
setMultiGPUFlag() {
|
||||
gpuCount=$(getGPUCount)
|
||||
if [ $gpuCount -gt 1 ]; then
|
||||
MULTI_GPU=1
|
||||
else
|
||||
MULTI_GPU=0
|
||||
fi
|
||||
}
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case "$1" in
|
||||
-p | --platform )
|
||||
shift 1; PLATFORM=$1 ;;
|
||||
-g | --gdb )
|
||||
GDB="gdb --args" ;;
|
||||
-l | --list )
|
||||
printGpuNodelist; exit 0 ;;
|
||||
-n | --node )
|
||||
shift 1; NODE=$1 ;;
|
||||
--high)
|
||||
FORCE_HIGH="true" ;;
|
||||
-h | --help )
|
||||
printUsage; exit 0 ;;
|
||||
*)
|
||||
GTEST_ARGS=$@; break;;
|
||||
esac
|
||||
shift 1
|
||||
done
|
||||
|
||||
KFDTEST="$BIN_DIR/kfdtest"
|
||||
|
||||
if [ "$FORCE_HIGH" == "true" ]; then
|
||||
pushGpuDpmState high
|
||||
pushTrap "popGpuDpmState" EXIT
|
||||
fi
|
||||
|
||||
setMultiGPUFlag
|
||||
# Set HSA_DEBUG env to run KFDMemoryTest.PtraceAccessInvisibleVram
|
||||
export HSA_DEBUG=1
|
||||
runKfdTest
|
||||
Criar uma nova questão referindo esta
Bloquear um utilizador