Skip to content

Commit

Permalink
Set RPATH for the loader (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
al42and committed Sep 10, 2024
1 parent c9d0b47 commit 4a9961d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
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

0 comments on commit 4a9961d

Please sign in to comment.