From e3879bc5c11f3220ff1fcb04fd327e0f05e60230 Mon Sep 17 00:00:00 2001 From: rkebichi <54912798+rkebichi@users.noreply.github.com> Date: Fri, 31 Jan 2020 11:14:29 -0500 Subject: [PATCH] Update run.sh --- test/run.sh | 67 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/test/run.sh b/test/run.sh index af56efe5f3..55aa07e54f 100755 --- a/test/run.sh +++ b/test/run.sh @@ -33,10 +33,19 @@ if [ -n "$1" ] ; then test_filter=$1 fi +# traces comparison +trace_level=0 +# 0 is no trace comparison +# 1 is events count comparison +# 2 is events order comparison +if [ -n "$2" ] ; then + trace_level=$2 +fi + # debugger debugger="" -if [ -n "$2" ] ; then - debugger=$2 +if [ -n "$3" ] ; then + debugger=$3 fi # test check routin @@ -49,15 +58,44 @@ xeval_test() { eval_test() { label=$1 cmdline=$2 + trace="${3}.txt" + rtrace="${3}_r.txt" if [ $test_filter = -1 -o $test_filter = $test_number ] ; then echo "$label: \"$cmdline\"" test_runnum=$((test_runnum + 1)) - eval "$debugger $cmdline" + eval "$debugger $cmdline" | tee $rtrace if [ $? != 0 ] ; then echo "$label: FAILED" test_status=$(($test_status + 1)) else - echo "$label: PASSED" + case "$trace_level" in + "0") echo "$label: PASSED" + ;; + "1") + cnt_r=`../script/parse_trace.py -in $rtrace -cn` + cnt=`../script/parse_trace.py -in $trace -cn` + if [ "$cnt_r" = "$cnt" ] ; then + echo "$label: PASSED (trace compare, events count)" + else + echo "$label: FAILED (trace compare, events count)" + test_status=$(($test_status + 1)) + fi + ;; + "2") + cnt_r=`../script/parse_trace.py -in $rtrace -or` + cnt=`../script/parse_trace.py -in $trace -or` + if [ "$cnt_r" = "$cnt" ] ; then + echo "$label: PASSED (trace compare, events order)" + else + echo "$label: FAILED (trace compare, events order)" + echo "===cnt_r===" + echo $cnt_r + echo "===cnt===" + echo $cnt + test_status=$(($test_status + 1)) + fi + ;; + esac fi fi test_number=$((test_number + 1)) @@ -65,17 +103,22 @@ eval_test() { # Standalone test # rocTrecer is used explicitely by test -eval_test "standalone HIP test" "./test/MatrixTranspose_test" +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" # Tool test # rocTracer/tool is loaded by HSA runtime export HSA_TOOLS_LIB="test/libtracer_tool.so" -export ROCTRACER_DOMAIN="hip" -# HIP test -eval_test "tool HIP test" ./test/MatrixTranspose -# with trace sampling control -eval_test "tool HIP period test" "ROCP_CTRL_RATE=10:100000:1000000 ./test/MatrixTranspose" +# SYS test +export ROCTRACER_DOMAIN="sys:roctx" +eval_test "tool SYS test" ./test/MatrixTranspose "MatrixTranspose_sys_trace" +export ROCTRACER_DOMAIN="sys:hsa:roctx" +eval_test "tool SYS/HSA test" ./test/MatrixTranspose "MatrixTranspose_sys_hsa_trace" +# Tracing control +export ROCTRACER_DOMAIN="hip" +eval_test "tool period test" "ROCP_CTRL_RATE=10:100000:1000000 ./test/MatrixTranspose" "MatrixTranspose_hip_trace" # HSA test export ROCTRACER_DOMAIN="hsa" @@ -92,11 +135,11 @@ export ROCP_AGENTS=1 # each thread creates a queue pre GPU agent export ROCP_THRS=1 -eval_test "tool HSA test" ./test/hsa/ctrl +eval_test "tool HSA test" ./test/hsa/ctrl "ctrl_hsa_trace" echo "" > input.xml export ROCP_INPUT=input.xml -eval_test "tool HSA test input" ./test/hsa/ctrl +eval_test "tool HSA test input" ./test/hsa/ctrl "ctrl_hsa_input_trace" #valgrind --leak-check=full $tbin #valgrind --tool=massif $tbin