From c0c08b2f084f0b23cdc1a5652a2f30c0d3090534 Mon Sep 17 00:00:00 2001 From: "Baraldi, Giovanni" Date: Tue, 1 Jul 2025 22:08:29 +0200 Subject: [PATCH] [rocprofv3] Fix ATT library path (#476) * Fix library path * Update docs * Review comments * Update source/bin/rocprofv3.py --------- Co-authored-by: Giovanni Baraldi --- source/bin/rocprofv3.py | 18 ++++++++++++------ source/docs/how-to/using-thread-trace.rst | 8 ++++++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/source/bin/rocprofv3.py b/source/bin/rocprofv3.py index 0a807eb446..97b0c6580b 100755 --- a/source/bin/rocprofv3.py +++ b/source/bin/rocprofv3.py @@ -166,7 +166,7 @@ def resolve_library_path(val, args, is_sdk_lib=True): return val -def check_att_capability(args, att_lib_name="librocprof-trace-decoder.so"): +def get_att_paths(args): ROCPROFV3_DIR = os.path.dirname(os.path.realpath(__file__)) ROCM_DIR = os.path.dirname(ROCPROFV3_DIR) @@ -177,17 +177,23 @@ def check_att_capability(args, att_lib_name="librocprof-trace-decoder.so"): if args.att_library_path: library_paths.extend(args.att_library_path) + elif os.environ.get("ROCPROF_ATT_LIBRARY_PATH"): + return os.environ.get("ROCPROF_ATT_LIBRARY_PATH") else: default_lib_path_env = os.environ.get("LD_LIBRARY_PATH", "").split(":") + [ f"{ROCM_DIR}/lib" ] - defined_att_path_env = os.environ.get("ROCPROF_ATT_LIBRARY_PATH", "").split(":") - att_paths = defined_att_path_env if defined_att_path_env else default_lib_path_env - for itr in att_paths: - # don't add duplicates + for itr in default_lib_path_env: if itr not in library_paths: library_paths += [itr] + return library_paths + + +def check_att_capability(args, att_lib_name="librocprof-trace-decoder.so"): + + library_paths = get_att_paths(args) + for path in library_paths: for root, dirs, files in os.walk(path, topdown=True): for itr in files: @@ -1550,7 +1556,7 @@ def run(app_args, args, **kwargs): ) else: fatal_error( - f"rocprof-trace-decoder library path not found in {args.att_library_path}" + f"rocprof-trace-decoder library path not found in {get_att_paths(args)}" ) if args.att_perfcounters: diff --git a/source/docs/how-to/using-thread-trace.rst b/source/docs/how-to/using-thread-trace.rst index 6d6b633707..6ff22b10da 100644 --- a/source/docs/how-to/using-thread-trace.rst +++ b/source/docs/how-to/using-thread-trace.rst @@ -47,9 +47,13 @@ Prerequisites * For binary files, see `ROCprof trace decoder release page `_. - * Default location is ``/opt/rocm/lib`` + * Default install location is ``/opt/rocm/lib`` - * For custom location, use parameter ``--att-library-path`` + * For custom location, use: + + * Parameter ``--att-library-path``, or + + * Environment variable ``ROCPROF_ATT_LIBRARY_PATH`` .. _thread-trace-parameters: