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

[BLAS, cuBLAS backend, hipSYCL] Add official hipsycl cuBLAS support #166

Merged
merged 2 commits into from
Sep 16, 2022
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
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ else()
message(STATUS "Looking for hipSYCL")
find_package(hipSYCL CONFIG REQUIRED)
set(USE_ADD_SYCL_TO_TARGET_INTEGRATION true)
set (CMAKE_CXX_STANDARD 17)
add_library(ONEMKL::SYCL::SYCL INTERFACE IMPORTED)
elseif(ONEMKL_SYCL_IMPLEMENTATION STREQUAL "dpc++")
message(STATUS "Looking for dpc++")
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ Supported domains: BLAS, LAPACK, RNG
<td align="center">NVIDIA GPU</td>
<td align="center">NVIDIA cuBLAS</td>
<td align="center">Dynamic, Static</td>
<td align="center">LLVM*</td>
<td align="center">LLVM*,hipSYCL</td>
</tr>
<tr>
<td align="center">x86 CPU</td>
Expand Down Expand Up @@ -377,7 +377,7 @@ Microsoft Windows* Server | 2016, 2019 | *Not supported*
</tr>
<td rowspan=2> Linux* only </td>
<td> NVIDIA GPU </td>
<td> Intel project for LLVM* technology </td>
<td> Intel project for LLVM* technology <br> or <br> hipSYCL with CUDA backend and dependencies </td>
<td> No </td>
<tr>
<td>AMD GPU</td>
Expand Down
44 changes: 30 additions & 14 deletions cmake/FindcuBLAS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,36 @@ add_compile_definitions(CUDA_NO_HALF)
find_package(Threads REQUIRED)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(cuBLAS
REQUIRED_VARS
CUDA_TOOLKIT_INCLUDE
CUDA_cublas_LIBRARY
CUDA_LIBRARIES
CUDA_CUDA_LIBRARY
OPENCL_INCLUDE_DIR
)


if(NOT TARGET ONEMKL::cuBLAS::cuBLAS)
add_library(ONEMKL::cuBLAS::cuBLAS SHARED IMPORTED)
set_target_properties(ONEMKL::cuBLAS::cuBLAS PROPERTIES
IMPORTED_LOCATION ${CUDA_cublas_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${OPENCL_INCLUDE_DIR};${CUDA_TOOLKIT_INCLUDE}"
INTERFACE_LINK_LIBRARIES "Threads::Threads;${CUDA_CUDA_LIBRARY};${CUDA_LIBRARIES}"
)

if(USE_ADD_SYCL_TO_TARGET_INTEGRATION)
find_package_handle_standard_args(cuBLAS
REQUIRED_VARS
CUDA_TOOLKIT_INCLUDE
CUDA_cublas_LIBRARY
CUDA_LIBRARIES
CUDA_CUDART_LIBRARY
)
set_target_properties(ONEMKL::cuBLAS::cuBLAS PROPERTIES
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any reasons we cannot use one set_target_properties? I see the only difference: OPENCL_INCLUDE_DIR that can be added with inline check, something like "$<$BOOL:${USE_ADD_SYCL_TO_TARGET_INTEGRATION}: ${OPENCL_INCLUDE_DIR}>"

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure...but i also see differences between CUDA_CUDART_LIBRARY vs CUDA_CUDA_LIBRARY

IMPORTED_LOCATION ${CUDA_cublas_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${CUDA_TOOLKIT_INCLUDE}"
INTERFACE_LINK_LIBRARIES "Threads::Threads;${CUDA_LIBRARIES};${CUDA_CUDART_LIBRARY}"
)
else()
find_package_handle_standard_args(cuBLAS
REQUIRED_VARS
CUDA_TOOLKIT_INCLUDE
CUDA_cublas_LIBRARY
CUDA_LIBRARIES
CUDA_CUDA_LIBRARY
OPENCL_INCLUDE_DIR
)
set_target_properties(ONEMKL::cuBLAS::cuBLAS PROPERTIES
IMPORTED_LOCATION ${CUDA_cublas_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES "${OPENCL_INCLUDE_DIR};${CUDA_TOOLKIT_INCLUDE}"
INTERFACE_LINK_LIBRARIES "Threads::Threads;${CUDA_CUDA_LIBRARY};${CUDA_LIBRARIES}"
)
endif()
endif()