From 9ef1b65d618cc65c8efa6fdc60a2e7c273d4ce89 Mon Sep 17 00:00:00 2001 From: Giovanni LB Date: Thu, 17 Aug 2023 15:49:32 -0300 Subject: [PATCH] DCGPUBU-44: Fixed pmc use of CLI plugin Change-Id: I751f15bddef0b431b2b5e2cb97d593eef64e94a0 [ROCm/rocprofiler commit: f715f4318a90107e723f5cee76c653cabd1a7090] --- projects/rocprofiler/bin/rocprofv2 | 9 ++++++--- projects/rocprofiler/src/tools/tool.cpp | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/projects/rocprofiler/bin/rocprofv2 b/projects/rocprofiler/bin/rocprofv2 index 4fc0123c2f..cf55435c90 100755 --- a/projects/rocprofiler/bin/rocprofv2 +++ b/projects/rocprofiler/bin/rocprofv2 @@ -232,16 +232,19 @@ if [ -n "$PMC_LINES" ] && [ ! -n "$ATT_ARGV" ]; then COUNTER=1 for i in ${!PMC_LINES[@]}; do export ROCPROFILER_COUNTERS="${PMC_LINES[$i]}" - #Skipping lines without pmc when not in att mode if [[ ! ${PMC_LINES[$i]} =~ "pmc" ]]; then continue fi FINAL_PATH="$OUTPUT_PATH_INTERNAL/pmc_$COUNTER" - export OUTPUT_PATH=$FINAL_PATH + if [ -n "$OUT_FILE_NAME" ] || [ -n "$OUTPUT_PATH" ]; then + export OUTPUT_PATH=$FINAL_PATH + fi let COUNTER=COUNTER+1 LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/lib/rocprofiler/librocprofiler_tool.so $* - echo -e "\nThe output path for the following counters: $OUTPUT_PATH" + if [ -n "$OUTPUT_PATH" ]; then + echo -e "\nThe output path for the following counters: $OUTPUT_PATH" + fi done else LD_PRELOAD=$LD_PRELOAD:$ROCM_DIR/lib/rocprofiler/librocprofiler_tool.so $* diff --git a/projects/rocprofiler/src/tools/tool.cpp b/projects/rocprofiler/src/tools/tool.cpp index fdb8e084a7..f450c8a118 100644 --- a/projects/rocprofiler/src/tools/tool.cpp +++ b/projects/rocprofiler/src/tools/tool.cpp @@ -452,7 +452,7 @@ void plugins_load() { } catch (...) {} out_path = out_path + '/'; } - if (getenv("ROCPROFILER_COUNTERS")) { + if (out_path.size() && getenv("ROCPROFILER_COUNTERS")) { std::ofstream(out_path+"pmc.txt", std::ios::app) << std::string(getenv("ROCPROFILER_COUNTERS")) << '\n'; }