Update build_python_packages.py to package rocprofiler-compute and rocprofiler-systems into profiler wheel: Phase 3#4518
Conversation
…cprofiler-systems into profiler wheel
build_python_packages.py to package rocprofiler-compute and rocprofiler-systems into profiler wheelbuild_python_packages.py to package rocprofiler-compute and rocprofiler-systems into profiler wheel: Phase 3
|
Just to confirm, the librocm_sysdeps .so files are present in the python package but are just not linked properly? We had some issues with this before where you had to manually set LD_LIBRARY_PATH to point to the rocm_sysdeps, wanted to confirm that we can still do the same workaround to get around this for now |
I just double checked - so yes - at this point the Addressed that by (1) including the required As a temporary workaround, manually setting @jbonnell-amd, FYI, updated the code. |
jbonnell-amd
left a comment
There was a problem hiding this comment.
Looks good! @dgaliffiAMD any comments regarding the rpath/libs for rocprofiler-systems?
|
I pulled the latest artifacts from https://therock-ci-artifacts.s3.amazonaws.com/24581668095-linux/python/gfx94X-dcgpu/index.html and ran some basic tests, like
|
|
@dgaliffiAMD, thanks for the feedback - I answered your questions and update the code. Please see below:
Thanks for confirming — this is now resolved with the latest changes. The required sysdeps (including sqlite3) are pulled from
I added
This was not intentional — thanks for pointing it out.
Given the submodule dependency, I implemented this fix in packaging to unblock the PR. We can consider updating the dlopen logic upstream in a follow-up to make it more robust to versioned names. |
|
Sorry, still waiting for the workflows to complete, so I can look at the packages. It seems like you have everything covered though. Do you have any concerns with the maintainability of that new map that you added? |
No worries, thanks again for your feedback, yes, I do have a maintainability concern with the explicit map, but I think it is acceptable for this step. I can come up with better solution soon in the follow up PRs I have more phases to finalize this packaging, currently I am in Phase 3. Please see: #3573. So, I can take a look better solution before I jump to the Phase 4 and 5. |
…4751) Follow-up for #4518 Replace manual rocprof-sys symlink map with pattern-based generation - generate unversioned librocprof-sys*.so symlinks from versioned .so.* files - removes need for manual maintenance of symlink list - preserves dlopen compatibility for rocprof-sys runtime Validated: - `_rocm_profiler` no longer bundles duplicate `rocm_sysdeps` - `_rocm_sdk_core/lib/rocm_sysdeps/lib` contains the sysdeps payload - unversioned `librocprof-sys*.so` symlinks are present after pip install - `ldd` shows `rocprof-sys-run` resolving `librocm_sysdeps_*` from `_rocm_sdk_core/lib/rocm_sysdeps/lib` - `ldd` shows `rocprof-sys-instrument` resolving `libomp.so` from `_rocm_sdk_core/lib/llvm/lib` - no unresolved shared-library dependencies for the tested `rocprof-sys-*` binaries - direct `dlopen()` of `librocprof-sys-dl.so` succeeds - end-to-end runtime test `rocprof-sys-sample -- ls -al` succeeds ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Progress on #3573 ## Motivation This PR exposes the `rocprof-sys-attach` CLI in the `rocm-profiler` Python wheel by adding the missing console entry point and trampoline wrapper. Based on discussion in here: #4518, #4518 (comment) ## Test Plan and Result ```python python build_tools/build_python_packages.py \ --artifact-dir ~/therock-multiarch-root \ --dest-dir /tmp/therock-profiler-test \ --build-packages python -m pip install --force-reinstall \ /tmp/therock-profiler-test/dist/rocm_sdk_core-*.whl python -m pip install --force-reinstall \ /tmp/therock-profiler-test/dist/rocm_profiler-*.whl ``` ```bash rocprof-sys-attach --help Usage: /home/nod/ergurses/TheRock/.venv-build-therock/lib/python3.12/site-packages/_rocm_profiler/bin/rocprof-sys-attach -p <pid> [OPTIONS] Attach to a running process for profiling. Options: -p <pid> Process ID to attach to (required) -o, --output PATH Output path for profiling results -F, --format FORMAT[,FORMAT,...] Output format(s): perfetto, rocpd -h, --help Show this help message Environment variables: ROCPROFSYS_OUTPUT_PATH Output directory for profiling data ROCPROFSYS_TRACE Enable perfetto trace output ROCPROFSYS_USE_ROCPD Enable rocpd database output ROCPROF_ATTACH_TOOL_LIBRARY Path to the tool library Once attached, press ENTER to detach from the process. ``` ## Submission Checklist - [x] Look over the contributing guidelines at https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
Progress on #3573
Motivation
This PR introduces a dedicated
rocm-profilerwheel forrocprof-sysandrocprof-computeby packaging directly from profiler artifacts instead of relying onbase.The goal is to:
rocprofiler-computeandrocprofiler-systemsinto a dedicated profiler wheelrocprof-compute,rocprof-sys-*) are available and functional from the installed wheelTechnical Details
Artifact Selection
rocprofiler-compute(lib,run)rocprofiler-systems(lib,run)sysdeps(lib) for runtime dependency closureRuntime Payload Updates
rocm_sysdepsruntime libraries:librocm_sysdeps_dw.so*librocm_sysdeps_elf.so*librocm_sysdeps_z.so*librocm_sysdeps_zstd.so*librocm_sysdeps_liblzma.so*librocm_sysdeps_bz2.so*RPATH Fixes
core/libcore/lib/llvm/liblibomp.sofromrocm-sdk-coreCLI Runtime Fix
_cli.pyto extendLD_LIBRARY_PATHat runtime:_rocm_sdk_core/lib/rocm_sysdeps/libOther Packaging Updates
bin/rocprof-compute -> ../libexec/rocprofiler-compute/rocprof-compute_rocm_profilerplatform filesbaseTest Plan
Artifact Preparation
base_{lib,run}_genericrocprofiler-compute_{lib,run}_genericrocprofiler-systems_{lib,run}_genericsysdeps_lib_genericamd-llvm_lib_genericBuild
Install
Validation
Dependency Checks
Test Result
Verified the following profiler entrypoints execute successfully from the installed wheel:
All commands print usage without missing shared library errors.
rocprof-compute --helpexecutes successfullyAll
rocprof-sys-*entrypoints execute and print usage:run,avail,causal,instrument,samplelibomp.sois correctly resolved fromrocm-sdk-core:All required sysdeps libraries are now packaged and resolved:
librocm_sysdeps_dw.so.1librocm_sysdeps_elf.so.1librocm_sysdeps_z.so.1librocm_sysdeps_zstd.so.1librocm_sysdeps_liblzma.so.5librocm_sysdeps_bz2.soNo remaining missing dependency errors from
lddRemaining runtime output is limited to host
/opt/rocmwarnings (e.g.libamd_smi.so.26), not missing packaging contentSummary
rocm-profileris now correctly built from profiler artifacts