Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPATH to tests to point to private libraries. #200

Merged
merged 4 commits into from
Jun 25, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions share/rocmcmakebuildtools/cmake/ROCMTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,9 @@ function(rocm_install_test)
set(INSTALL_PREFIX "$<TARGET_PROPERTY:tests,ROCM_TEST_INSTALLDIR>")
if(PARSE_TARGETS)
foreach(TARGET ${PARSE_TARGETS})
if(POLICY CMP0095)
set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "\${ORIGIN}/../../../lib")
else()
set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "\\\${ORIGIN}/../../../lib")
endif()
set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib")
# Adding RPATH to public tests to point to private libraries.
set_property(TARGET ${TARGET} APPEND PROPERTY INSTALL_RPATH "$ORIGIN/../../../../lib/${PROJECT_NAME}/lib")
Comment on lines +224 to +226
Copy link
Contributor Author

@ahsan-ca ahsan-ca Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pfultz2 I found that the tests are installed at /opt/rocm/libexec/installed-tests/migraphx/bin, so I modified the relative path to $ORIGIN/../../../../lib from $ORIGIN/../../../lib (backtracking 4 directory levels instead of 3). I am not sure why we were stepping out of 3 directories only, before my change.

Below is the output of ldd for test_verify (stepping out of 4 l:

ldd /opt/rocm/libexec/installed-tests/migraphx/bin/test_verify
        linux-vdso.so.1 (0x00007ffe90ddf000)
        libmigraphx_ref.so.2010000 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/migraphx/lib/libmigraphx_ref.so.2010000 (0x00007f72b14bc000)
        libmigraphx_cpu.so.2010000 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/migraphx/lib/libmigraphx_cpu.so.2010000 (0x00007f72b0cff000)
        libdnnl.so.1 => /usr/local/lib/libdnnl.so.1 (0x00007f72aeb42000)
        libomp.so => /opt/rocm-6.0.2/lib/llvm/lib/libomp.so (0x00007f72aea4f000)
        libmigraphx_gpu.so.2010000 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/migraphx/lib/libmigraphx_gpu.so.2010000 (0x00007f72a5a88000)
        librocblas.so.4 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/librocblas.so.4 (0x00007f7273941000)
        libMIOpen.so.1 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/libMIOpen.so.1 (0x00007f723c58d000)
        libamdhip64.so.6 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/libamdhip64.so.6 (0x00007f723aade000)
        libmigraphx.so.2010000 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/migraphx/lib/libmigraphx.so.2010000 (0x00007f72382a7000)
        libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7238072000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f7237f8b000)
        libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7237f6b000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f7237d42000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f72b178a000)
        libmigraphx_device.so.2010000 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/migraphx/lib/../lib/libmigraphx_device.so.2010000 (0x00007f7236a7a000)
        libamd_comgr.so.2 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/libamd_comgr.so.2 (0x00007f722e16c000)
        libroctx64.so.4 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/libroctx64.so.4 (0x00007f722e167000)
        libhsa-runtime64.so.1 => /opt/rocm/libexec/installed-tests/migraphx/bin/../../../../lib/libhsa-runtime64.so.1 (0x00007f722dea3000)
        libnuma.so.1 => /lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f722de96000)
        libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f722de7a000)
        libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007f722de46000)
        libelf.so.1 => /lib/x86_64-linux-gnu/libelf.so.1 (0x00007f722de28000)
        libdrm.so.2 => /lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f722de12000)
        libdrm_amdgpu.so.1 => /lib/x86_64-linux-gnu/libdrm_amdgpu.so.1 (0x00007f722de06000)
        

Do you think my change for relative path is correct or am I missing something here?

endforeach()
install(
TARGETS ${PARSE_TARGETS}
Expand Down
Loading