rocprofiler icon indicating copy to clipboard operation
rocprofiler copied to clipboard

rocprof bash sets PATH to the wrong location, then fails to find rocminfo

Open JonChesterfield opened this issue 1 year ago • 1 comments

Problem Description

The rocprof bash script installed under bin/rocprof sets path to export PATH=.:$PATH. I think this is intended to put the current directory on the path such that things like rocminfo can be found next to rocprof. That only works when running rocprof from the current directory.

/bin/sh: 1: rocminfo: not found
Traceback (most recent call last):
  File "/home/amd/rocm/aomp_19.0-2/libexec/rocprofiler/tblextr.py", line 1113, in <module>
    metadata_gen(sysinfo_file, "rocminfo")
  File "/home/amd/rocm/aomp_19.0-2/libexec/rocprofiler/tblextr.py", line 124, in metadata_gen
    raise Exception('Could not run command: "' + sysinfo_cmd + '"')
Exception: Could not run command: "rocminfo"

If this is changed to something like export PATH=$BIN_DIR:$PATH then rocprof successfully finds rocminfo.

Related, there's a error message that is intended to print when rocminfo is not found, instead of the above trace:

if !command -v rocminfo > /dev/null 2>&1 ;  then
  error "'rocminfo' utility is not found: please add ROCM bin path to PATH env var.";
fi

I don't believe that works as intended, adding parens would be one way to retrieve the nicer message

if !(command -v rocminfo > /dev/null 2>&1) ;  then
  error "'rocminfo' utility is not found: please add ROCM bin path to PATH env var.";
fi

Operating System

Ubuntu

CPU

2990WX

GPU

AMD Radeon VII

ROCm Version

ROCm 6.1.0

ROCm Component

rocprofiler

Steps to Reproduce

Change to a directory other than the one containing rocprof. Run rocprof. Note the stack trace from python.

(Optional for Linux users) Output of /opt/rocm/bin/rocminfo --support

No response

Additional Information

No response

JonChesterfield avatar Jul 10 '24 22:07 JonChesterfield