From c0703c063c8191c8a800e81d023fe853ed77d8a3 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Thu, 16 May 2019 12:07:07 -0500 Subject: [PATCH] support for python apps profiling Change-Id: I2dd6d9d760abb1dab59f0d3464b9a50008694187 --- bin/rpl_run.sh | 22 +++++++++------------- bin/tblextr.py | 13 ++++++++++--- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/bin/rpl_run.sh b/bin/rpl_run.sh index 78edf446b1..f29582a828 100755 --- a/bin/rpl_run.sh +++ b/bin/rpl_run.sh @@ -30,12 +30,12 @@ RUN_DIR=`pwd` TMP_DIR="/tmp" DATA_DIR="rpl_data_${time_stamp}_$$" +RPL_PATH=$PKG_DIR/lib +TLIB_PATH=$PKG_DIR/tool + # PATH to custom HSA and OpenCl runtimes HSA_PATH=$PKG_DIR/lib/hsa -# roctracer path -if [ -z "$ROCTRACER_PATH" ] ; then ROCTRACER_PATH=$ROOT_DIR/roctracer; fi - # runtime API trace HSA_TRACE=0 HIP_TRACE=0 @@ -43,7 +43,7 @@ HIP_TRACE=0 # Generate stats GEN_STATS=0 -export LD_LIBRARY_PATH=$PKG_DIR/lib:$PKG_DIR/tool:$ROCTRACER_PATH/lib:$ROCTRACER_PATH/tool:$HSA_PATH +export LD_LIBRARY_PATH=$HSA_PATH:$LD_LIBRARY_PATH export PATH=.:$PATH # enable error logging @@ -54,9 +54,9 @@ unset ROCPROFILER_SESS # ROC Profiler environment # Loading of ROC Profiler by HSA runtime -export HSA_TOOLS_LIB=librocprofiler64.so +export HSA_TOOLS_LIB=$RPL_PATH/librocprofiler64.so # Loading of the test tool by ROC Profiler -export ROCP_TOOL_LIB=libtool.so +export ROCP_TOOL_LIB=$TLIB_PATH/libtool.so # Enabling HSA dispatches intercepting by ROC PRofiler export ROCP_HSA_INTERCEPT=1 # Disabling internal ROC Profiler proxy queue (simple version supported for testing purposes) @@ -129,7 +129,7 @@ usage() { echo " >" echo "" echo " -o - output CSV file [.csv]" - echo " -d - directory where profiler store profiling data including thread treaces [/tmp]" + echo " -d - directory where profiler store profiling data including traces [/tmp]" echo " The data directory is renoving autonatically if the directory is matching the temporary one, which is the default." echo " -t - to change the temporary directory [/tmp]" echo " By changing the temporary directory you can prevent removing the profiling data from /tmp or enable removing from not '/tmp' directory." @@ -201,7 +201,6 @@ run() { fi API_TRACE="" - PRELOAD_LIBS="" if [ "$HSA_TRACE" = 1 ] ; then API_TRACE="hsa" fi @@ -211,14 +210,11 @@ run() { else API_TRACE="all" fi - if [ -z "$HCC_HOME" ] ; then error "env var HCC_HOME is not defined"; fi - PRELOAD_LIBS="$PRELOAD_LIBS $HCC_HOME/lib/libmcwamp_hsa.so" fi if [ -n "$API_TRACE" ] ; then API_TRACE=$(echo $API_TRACE | sed 's/all//') if [ -n "$API_TRACE" ] ; then export ROCTRACER_DOMAIN=$API_TRACE; fi - export HSA_TOOLS_LIB="libtracer_tool.so libroctracer64.so $HSA_TOOLS_LIB" - PRELOAD_LIBS="$PRELOAD_LIBS $HSA_TOOLS_LIB" + export HSA_TOOLS_LIB="$RPL_PATH/libroctracer64.so $TLIB_PATH/libtracer_tool.so $HSA_TOOLS_LIB" fi redirection_cmd="" @@ -228,7 +224,7 @@ run() { fi #unset ROCP_OUTPUT_DIR - CMD_LINE="LD_PRELOAD='$PRELOAD_LIBS' $APP_CMD $redirection_cmd" + CMD_LINE="$APP_CMD $redirection_cmd" eval "$CMD_LINE" } diff --git a/bin/tblextr.py b/bin/tblextr.py index 329ab0d8a4..818e85f2ae 100755 --- a/bin/tblextr.py +++ b/bin/tblextr.py @@ -56,6 +56,13 @@ var_table = {} def fatal(msg): sys.stderr.write(sys.argv[0] + ": " + msg + "\n"); sys.exit(1) + +dbglog_count = 0 +def dbglog(msg): + global dbglog_count + dbglog_count += 1 + sys.stderr.write(sys.argv[0] + ": " + msg + "\n"); + fatal("error") ############################################################# # parse results method @@ -224,7 +231,7 @@ def fill_api_db(table_name, db, indir, api_name, api_pid, dep_pid, dep_list, dep dep_tid_list.append(int(rec_vals[3])) dep_id_list.append(record_id) record_id += 1 - else: fatal("hsa bad record") + else: fatal(api_name + " bad record: '" + record + "'") for (tid, from_ns) in dep_list: db.insert_entry(table_handle, [from_ns, from_ns, api_pid, tid, 'hsa_dispatch', '', record_id]) @@ -267,7 +274,7 @@ def fill_copy_db(table_name, db, indir): else: fatal("bad async-copy entry") rec_vals.append(m.group(1)) db.insert_entry(table_handle, rec_vals) - else: fatal("async-copy bad record") + else: fatal("async-copy bad record: '" + record + "'") dep_dict[COPY_PID]['to'] = dep_to_us_dict ############################################################# @@ -313,7 +320,7 @@ def fill_ops_db(table_name, db, indir): dep_dict[gpu_pid]['to'] = {} dep_dict[gpu_pid]['to'][corr_id] = int(rec_vals[0]) / 1000 dep_dict[gpu_pid]['bsp'] = OPS_PID - else: fatal("async-copy bad record") + else: fatal("hcc ops bad record: '" + record + "'") return filtr #############################################################