Dosyalar
rocm-systems/test/run.sh
T

131 satır
4.4 KiB
Bash
Ham Normal Görünüm Geçmiş

2020-03-28 21:39:31 -05:00
#!/bin/sh -x
2018-11-28 12:36:11 -06:00
################################################################################
# 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.
################################################################################
2020-03-28 21:39:31 -05:00
# cd to build directory
BIN_DIR=`dirname $0`
cd $BIN_DIR
2018-11-28 12:36:11 -06:00
# enable tools load failure reporting
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
2020-03-28 22:01:09 -05:00
# paths to ROC profiler and other libraries
2019-10-25 10:11:16 -05:00
export LD_LIBRARY_PATH=$PWD
2019-07-27 06:19:35 -05:00
# test filter input
test_filter=-1
if [ -n "$1" ] ; then
test_filter=$1
fi
2019-01-17 15:04:54 -06:00
# test check routin
test_status=0
2019-07-27 06:19:35 -05:00
test_runnum=0
2019-03-11 21:15:34 -05:00
test_number=0
2020-03-27 00:32:18 -05:00
failed_tests="Failed tests:"
2019-07-27 06:19:35 -05:00
xeval_test() {
test_number=$test_number
}
2020-03-10 15:39:25 -04:00
2019-01-17 15:04:54 -06:00
eval_test() {
label=$1
cmdline=$2
2020-03-27 00:32:18 -05:00
test_name=$3
test_trace=$test_name.txt
2019-07-27 06:19:35 -05:00
if [ $test_filter = -1 -o $test_filter = $test_number ] ; then
2020-03-27 00:32:18 -05:00
echo "test $test_number: $test_name \"$label\""
echo "CMD: \"$cmdline\""
2019-07-27 06:19:35 -05:00
test_runnum=$((test_runnum + 1))
2020-03-27 00:32:18 -05:00
eval "$cmdline" | tee $test_trace
is_failed=$?
if [ $is_failed = 0 ] ; then
python ../script/check_trace.py -in $test_name
is_failed=$?
fi
if [ $is_failed = 0 ] ; then
echo "$test_name: PASSED"
2019-07-27 06:19:35 -05:00
else
2020-03-27 00:32:18 -05:00
echo "$test_name: FAILED"
2020-03-28 22:01:09 -05:00
failed_tests="$failed_tests\n $test_number: $test_name - \"$label\""
2020-03-27 00:32:18 -05:00
test_status=$(($test_status + 1))
2019-07-27 06:19:35 -05:00
fi
2019-01-17 15:04:54 -06:00
fi
2020-03-27 00:32:18 -05:00
2019-07-27 06:19:35 -05:00
test_number=$((test_number + 1))
2019-01-17 15:04:54 -06:00
}
2019-01-15 11:29:18 -06:00
2019-01-17 15:04:54 -06:00
# Standalone test
2019-01-15 13:18:47 -06:00
# rocTrecer is used explicitely by test
2020-03-27 00:32:18 -05:00
eval_test "standalone C test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_ctest" MatrixTranspose_ctest_trace
eval_test "standalone HIP test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_test" MatrixTranspose_test_trace
eval_test "standalone HIP MGPU test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose_mgpu" MatrixTranspose_mgpu_trace
2019-01-15 11:29:18 -06:00
2019-01-17 15:04:54 -06:00
# Tool test
2019-01-15 13:18:47 -06:00
# rocTracer/tool is loaded by HSA runtime
2019-07-02 16:51:02 -05:00
export HSA_TOOLS_LIB="test/libtracer_tool.so"
2019-01-15 11:29:18 -06:00
2020-04-20 09:57:59 -05:00
# KFD test
export ROCTRACER_DOMAIN="kfd"
eval_test "tool KFD test" "LD_PRELOAD=libkfdwrapper64.so ./test/MatrixTranspose" MatrixTranspose_kfd_trace
2020-01-31 11:14:29 -05:00
# SYS test
export ROCTRACER_DOMAIN="sys:roctx"
2020-03-27 00:32:18 -05:00
eval_test "tool SYS test" ./test/MatrixTranspose MatrixTranspose_sys_trace
2020-01-31 11:14:29 -05:00
export ROCTRACER_DOMAIN="sys:hsa:roctx"
2020-03-27 00:32:18 -05:00
eval_test "tool SYS/HSA test" ./test/MatrixTranspose MatrixTranspose_sys_hsa_trace
2020-01-31 11:14:29 -05:00
# Tracing control <delay:length:rate>
export ROCTRACER_DOMAIN="hip"
2020-03-27 00:32:18 -05:00
eval_test "tool period test" "ROCP_CTRL_RATE=10:100000:1000000 ./test/MatrixTranspose" MatrixTranspose_hip_period_trace
eval_test "tool flushing test" "ROCP_FLUSH_RATE=100000 ./test/MatrixTranspose" MatrixTranspose_hip_flush_trace
2019-01-17 15:04:54 -06:00
# HSA test
export ROCTRACER_DOMAIN="hsa"
2018-11-28 12:36:11 -06:00
# test trace
export ROC_TEST_TRACE=1
# kernels loading iterations
export ROCP_KITER=1
# kernels dispatching iterations per kernel load
# dispatching to the same queue
export ROCP_DITER=1
# GPU agents number
export ROCP_AGENTS=1
# host threads number
# each thread creates a queue pre GPU agent
export ROCP_THRS=1
2020-03-27 00:32:18 -05:00
eval_test "tool HSA test" ./test/hsa/ctrl ctrl_hsa_trace
2018-11-28 12:36:11 -06:00
2019-04-01 21:37:42 -05:00
echo "<trace name=\"HSA\"><parameters api=\"hsa_agent_get_info, hsa_amd_memory_pool_allocate\"></parameters></trace>" > input.xml
2019-01-17 22:39:53 -06:00
export ROCP_INPUT=input.xml
2020-03-27 00:32:18 -05:00
eval_test "tool HSA test input" ./test/hsa/ctrl ctrl_hsa_input_trace
2019-01-17 22:39:53 -06:00
2018-11-28 12:36:11 -06:00
#valgrind --leak-check=full $tbin
#valgrind --tool=massif $tbin
#ms_print massif.out.<N>
2019-07-27 06:19:35 -05:00
echo "$test_number tests total / $test_runnum tests run / $test_status tests failed"
2020-03-27 00:32:18 -05:00
if [ $test_status != 0 ] ; then
echo $failed_tests
fi
2019-01-17 15:04:54 -06:00
exit $test_status