################################################################################
## MIT License
##
## Copyright (c) 2017 ROCm Core Technology
##
## 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.
################################################################################
#!/bin/sh
time_stamp=`date +%y%m%d_%H%M%S`
BIN_DIR=`dirname $0`
BIN_DIR=`cd $BIN_DIR; pwd`
RUN_DIR=`pwd`
TMP_DIR="/tmp"
DATA_PATH=$TMP_DIR
DATA_DIR="rpl_data_${time_stamp}_$$"
PKG_DIR=`echo $BIN_DIR | sed "s/\/bin\/*//"`
BIN_DIR=$PKG_DIR/bin
# PATH to custom HSA and OpenCl runtimes
HSA_PATH=$PKG_DIR/lib/hsa
export LD_LIBRARY_PATH=$PKG_DIR/lib:$PKG_DIR/tool:$HSA_PATH
export PATH=.:$PATH
# enable error logging
export HSA_TOOLS_REPORT_LOAD_FAILURE=1
export HSA_VEN_AMD_AQLPROFILE_LOG=1
export ROCPROFILER_LOG=1
unset ROCPROFILER_SESS
# ROC Profiler environment
# Loading of ROC Profiler by HSA runtime
export HSA_TOOLS_LIB=librocprofiler64.so
# Loading of the test tool by ROC Profiler
export ROCP_TOOL_LIB=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)
unset ROCP_PROXY_QUEUE
# ROC Profiler metrics definition
export ROCP_METRICS=$PKG_DIR/lib/metrics.xml
# ROC Profiler package path
export ROCP_PACKAGE_DIR=$PKG_DIR
# error handling
fatal() {
echo "$0: Error: $1"
echo ""
usage
}
error() {
echo "$0: Error: $1"
echo ""
exit 1
}
# usage method
usage() {
bin_name=`basename $0`
echo "ROCm Profiling Library (RPL) run script, a part of ROCprofiler library package."
echo "Full path: $BIN_DIR/$bin_name"
echo "Metrics definition: $PKG_DIR/lib/metrics.xml"
echo ""
echo "Usage:"
echo " rpl_run.sh [-h] [--list-basic] [--list-derived] [-i ] [-o