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

Set RPATH for the loader #550

Merged
merged 3 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 0 additions & 3 deletions docs/building_and_running_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,3 @@ To run the tests, either run test binaries individually, or use ``ctest`` CMake
For more ``ctest`` options, refer to `ctest manual page <https://cmake.org/cmake/help/v3.13/manual/ctest.1.html>`_.

When running tests you may encounter the issue ``BACKEND NOT FOUND EXCEPTION``,
you may need to add your ``<oneMKL build directory>/lib`` to your
``LD_LIBRARY_PATH`` on Linux.
12 changes: 0 additions & 12 deletions docs/using_onemkl_with_cmake.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ during the build. To check for the existence of backends, CMake's ``if(TARGET
message(FATAL_ERROR "oneMKL Interfaces was not built with CuFFT backend")
endif()
If oneMKL Interfaces has been installed to a non-standard location, the
operating system may not find the backend libraries when they're lazily loaded
at runtime. To make sure they're found you may need to set
``LD_LIBRARY_PATH=<onemkl_install_dir>/lib:$LD_LIBRARY_PATH`` on Linux.

.. _using_with_fetchcontent:

Using CMake's FetchContent
Expand Down Expand Up @@ -93,10 +87,4 @@ against particular backends (as required for static dispatch of oneAPI calls to
a particular backend), use the target ``onemkl_<domain>_<backend>``. For
example, ``onemkl_dft_cufft``.

When using the run-time dispatch mechanism, it is likely that the operating
system will not find the backend libraries when they're loaded at runtime. To
make sure they're found you may need to set
``LD_LIBRARY_PATH=<onemkl_install_dir>/lib:$LD_LIBRARY_PATH`` on Linux.


.. _FetchContent: https://cmake.org/cmake/help/latest/module/FetchContent.html
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,10 @@ if(BUILD_SHARED_LIBS)
set (ONEMKL_LIBS ${TARGET_DOMAINS})
list(TRANSFORM ONEMKL_LIBS PREPEND onemkl_)
target_link_libraries(onemkl PUBLIC ${ONEMKL_LIBS})
set_target_properties(onemkl PROPERTIES
INSTALL_RPATH "\$ORIGIN"
BUILD_WITH_INSTALL_RPATH TRUE
)

# Add the library to install package
foreach(domain_lib ${ONEMKL_LIBS})
Expand Down
Loading