SDK: remove majority of exceptions (#176)
* SDK: remove majority of exceptions
- replace with ROCP_FATAL, ROCP_CI_LOG(WARNING), etc.
- improve logging of symbolic link
- add --readlink and --realpath (hidden options) to rocprofv3 to follow symlinks for preloaded libraries
* Add rocprofv3 --rocm-root argument
* Fix registration resolved_exists
* Fix rocprofv3_avail.py
* Update logging for rocprofiler_configure search
- relax failure conditions
* Misc clang-tidy fixes
* Fix merge
* Fix merge
---------
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
Co-authored-by: Bhardwaj, Gopesh <Gopesh.Bhardwaj@amd.com>
[ROCm/rocprofiler-sdk commit: 470f347e50]
Цей коміт міститься в:
@@ -546,6 +546,23 @@ For MPI applications (or other job launchers such as SLURM), place rocprofv3 ins
|
||||
nargs="*",
|
||||
)
|
||||
|
||||
advanced_options.add_argument(
|
||||
"--rocm-root",
|
||||
help="Use the given path as the root ROCm path instead of the relative path of this script",
|
||||
type=str,
|
||||
metavar="PATH",
|
||||
default=None,
|
||||
)
|
||||
add_parser_bool_argument(
|
||||
advanced_options,
|
||||
"--readlink",
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
add_parser_bool_argument(
|
||||
advanced_options,
|
||||
"--realpath",
|
||||
help=argparse.SUPPRESS,
|
||||
)
|
||||
# below is available for CI because LD_PRELOADing a library linked to a sanitizer library
|
||||
# causes issues in apps where HIP is part of shared library.
|
||||
add_parser_bool_argument(
|
||||
@@ -874,6 +891,8 @@ def run(app_args, args, **kwargs):
|
||||
|
||||
ROCPROFV3_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
ROCM_DIR = os.path.dirname(ROCPROFV3_DIR)
|
||||
if args.rocm_root is not None:
|
||||
ROCM_DIR = os.path.abspath(args.rocm_root)
|
||||
ROCPROF_TOOL_LIBRARY = f"{ROCM_DIR}/lib/rocprofiler-sdk/librocprofiler-sdk-tool.so"
|
||||
ROCPROF_SDK_LIBRARY = f"{ROCM_DIR}/lib/librocprofiler-sdk.so"
|
||||
ROCPROF_ROCTX_LIBRARY = f"{ROCM_DIR}/lib/librocprofiler-sdk-roctx.so"
|
||||
@@ -884,6 +903,22 @@ def run(app_args, args, **kwargs):
|
||||
f"{ROCM_DIR}/libexec/rocprofiler-sdk/librocprofv3-list-avail.so"
|
||||
)
|
||||
|
||||
def resolve_path(val):
|
||||
if not os.path.exists(val):
|
||||
fatal_error(f"{val} does not exist")
|
||||
if os.path.islink(val):
|
||||
if args.readlink:
|
||||
val = os.path.abspath(os.readlink(val))
|
||||
if args.realpath:
|
||||
val = os.path.realpath(val)
|
||||
return val
|
||||
|
||||
ROCPROF_TOOL_LIBRARY = resolve_path(ROCPROF_TOOL_LIBRARY)
|
||||
ROCPROF_SDK_LIBRARY = resolve_path(ROCPROF_SDK_LIBRARY)
|
||||
ROCPROF_ROCTX_LIBRARY = resolve_path(ROCPROF_ROCTX_LIBRARY)
|
||||
ROCPROF_KOKKOSP_LIBRARY = resolve_path(ROCPROF_KOKKOSP_LIBRARY)
|
||||
ROCPROF_LIST_AVAIL_TOOL_LIBRARY = resolve_path(ROCPROF_LIST_AVAIL_TOOL_LIBRARY)
|
||||
|
||||
prepend_preload = [itr for itr in args.preload if itr]
|
||||
append_preload = [
|
||||
ROCPROF_TOOL_LIBRARY,
|
||||
|
||||
Звичайний файл → Виконуваний файл
+12
-1
@@ -69,10 +69,21 @@ class pc_config:
|
||||
self.max_interval = max_interval
|
||||
|
||||
|
||||
ROCPROFV3_AVAIL_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
ROCM_DIR = os.path.dirname(ROCPROFV3_AVAIL_DIR)
|
||||
ROCPROF_LIST_AVAIL_TOOL_LIBRARY = (
|
||||
f"{ROCM_DIR}/libexec/rocprofiler-sdk/librocprofv3-list-avail.so"
|
||||
)
|
||||
|
||||
MAX_STR = 256
|
||||
libname = os.environ.get("ROCPROF_LIST_AVAIL_TOOL_LIBRARY")
|
||||
libname = os.environ.get(
|
||||
"ROCPROF_LIST_AVAIL_TOOL_LIBRARY", ROCPROF_LIST_AVAIL_TOOL_LIBRARY
|
||||
)
|
||||
c_lib = ctypes.CDLL(libname)
|
||||
|
||||
if c_lib is None:
|
||||
fatal_error(f"Error opening {libname}")
|
||||
|
||||
c_lib.get_number_of_counters.restype = ctypes.c_ulong
|
||||
c_lib.get_number_of_pc_sample_configs.restype = ctypes.c_ulong
|
||||
c_lib.get_number_of_dimensions.restype = ctypes.c_ulong
|
||||
|
||||
Посилання в новій задачі
Заблокувати користувача