Files
rocm-systems/source/bin/rocprofv3
T

79 строки
2.2 KiB
Bash
Исходник Обычный вид История

2023-11-28 10:04:37 -06:00
#!/bin/bash -e
set -eo pipefail
CURRENT_DIR="$( dirname -- "$0"; )";
ROCPROFV2_DIR=$(dirname -- $(realpath ${BASH_SOURCE[0]}));
ROCM_DIR=$( dirname -- "${ROCPROFV2_DIR}"; )
export HSA_TOOLS_LIB=${ROCM_DIR}/lib/librocprofiler-sdk.so.0
2023-11-28 10:04:37 -06:00
# Define color code
GREEN='\033[0;32m'
GREY='\033[0;90m'
RESET='\033[0m'
usage() {
2023-12-15 12:44:50 -06:00
echo -e "${RESET}ROCProfilerV3 Run Script Usage:"
2023-11-28 10:04:37 -06:00
echo -e "${GREEN}-h | --help ${RESET} For showing this message"
2023-12-15 12:44:50 -06:00
echo -e "${GREEN}--hsa-trace ${RESET} For Collecting HSA API Traces"
2023-11-28 10:04:37 -06:00
echo -e "${GREEN}--kernel-trace ${RESET} For Collecting Kernel Dispatch Traces"
echo -e "${GREEN}-o | --output-file ${RESET} For the output file name"
echo -e "\t#${GREY} usage e.g:(with current dir): rocprofv3 --hip-trace -o <file_name> <executable>"
echo -e "\t#${GREY} usage e.g:(with custom dir): rocprofv3 --hip-trace -d <out_dir> -o <file_name> <executable>${RESET}\n"
2023-11-28 10:04:37 -06:00
echo -e "${GREEN}-d | --output-directory ${RESET} For adding output path where the output files will be saved"
echo -e "\t#${GREY} usage e.g:(with custom dir): rocprofv3 --hip-trace -d <out_dir> <executable>${RESET}\n"
2023-11-28 10:04:37 -06:00
exit 1
}
if [ -z "$1" ]; then
usage
exit 1
fi
: ${ROCPROFILER_OUTPUT_PATH:="."}
while [ 1 ]; do
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
usage
exit 1
elif [[ "$1" == "-o" || "$1" == "--output-file-name" ]]; then
if [ $2 ]; then
export ROCPROFILER_OUTPUT_FILE_NAME=$2
else
usage
exit 1
fi
shift
shift
elif [[ "$1" == "-d" || "$1" == "--output-directory" ]]; then
if [ $2 ]; then
ROCPROFILER_OUTPUT_PATH=$2
else
usage
exit 1
fi
shift
shift
2023-12-15 12:44:50 -06:00
elif [ "$1" == "--hsa-trace" ]; then
2023-11-28 10:04:37 -06:00
export ROCPROFILER_HSA_API_TRACE=1
shift
elif [ "$1" == "--kernel-trace" ]; then
export ROCPROFILER_KERNEL_TRACE=1
shift
elif [ "$1" == "--" ]; then
shift
break
elif [[ "$1" == "-"* || "$1" == "--"* ]]; then
echo -e "Wrong option \"$1\", Please use the following options:\n"
usage
exit 1
else
break
fi
done
export ROCPROFILER_OUTPUT_PATH
2023-12-15 12:44:50 -06:00
ROCP_TOOL_LIBRARIES=${ROCM_DIR}/lib/rocprofiler-sdk/librocprofiler-sdk-tool.so "${@}"