-
Notifications
You must be signed in to change notification settings - Fork 79
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
Load rocSOLVER with dlopen at runtime #903
base: develop
Are you sure you want to change the base?
Changes from all commits
97d5a66
c0062ef
04b0448
b83fcbd
3aa4527
88730fe
23bd75b
89efef2
c252edc
f4e88db
0e28557
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,7 @@ endfunction( ) | |
prepend_path( ".." hipblas_headers_public relative_hipblas_headers_public ) | ||
|
||
if(HIP_PLATFORM STREQUAL amd) | ||
set( hipblas_source "${CMAKE_CURRENT_SOURCE_DIR}/amd_detail/hipblas.cpp" ) | ||
set( hipblas_source "${CMAKE_CURRENT_SOURCE_DIR}/amd_detail/hipblas.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/amd_detail/dlopen/load_rocsolver.cpp" ) | ||
else( ) | ||
set( hipblas_source "${CMAKE_CURRENT_SOURCE_DIR}/nvidia_detail/hipblas.cpp" ) | ||
endif( ) | ||
|
@@ -82,6 +82,11 @@ if(HIP_PLATFORM STREQUAL amd) | |
endif( ) | ||
endif( ) | ||
|
||
if(NOT BUILD_WITH_SOLVER) | ||
target_link_libraries(hipblas PRIVATE $<$<PLATFORM_ID:Linux>:${CMAKE_DL_LIBS}>) | ||
set_property(TARGET hipblas APPEND PROPERTY BUILD_RPATH ${ROCSOLVER_PATH}/lib) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What prompted this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is needed to find the rocsolver library if hipblas is built with the install script --rocsolver-path option There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep in mind that rocsolver might not actually even exist on the system at build-time. Personally, I wouldn't bother mucking around with the If you prefer to set the RPATH, it should be guarded to only be set when rocsolver exists and if(DEFINED ROCSOLVER_PATH)
find_package(rocsolver QUIET PATHS "${ROCSOLVER_PATH}" NO_DEFAULT_PATH)
if(rocsolver_FOUND)
get_target_property(rocsolver_location roc::rocsolver LOCATION)
get_filename_component(rocsolver_directory ${rocsolver_location} DIRECTORY)
set_property(TARGET hipblas APPEND PROPERTY BUILD_RPATH ${rocsolver_directory})
endif()
endif() With all that said, I prefer less code to more code. IMO, it's fine to expect users to set |
||
endif() | ||
|
||
list(APPEND static_depends PACKAGE rocblas) | ||
target_link_libraries( hipblas PRIVATE roc::rocblas ) | ||
target_link_libraries( hipblas PUBLIC hip::host ) | ||
|
@@ -93,6 +98,8 @@ if(HIP_PLATFORM STREQUAL amd) | |
set ( ENV{rocsolver_DIR} ${CUSTOM_ROCSOLVER}) | ||
find_package( rocsolver REQUIRED CONFIG NO_CMAKE_PATH ) | ||
|
||
target_compile_definitions(hipblas PRIVATE -DBUILD_WITH_SOLVER) | ||
|
||
# in case of using custom rocsolver and not custom rocblas, we need to have | ||
# custom rocsolver include directories before rocblas/hip include directories | ||
# in case there is a rocsolver installed on the system. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this just for testing or default to not link? Default to not link may may need to review effect on rpath or package consumption documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Default will be to not link. I think it'll be ok but I'll test out consuming the hipblas package now to make sure it find rocsolver.