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

Roc tpls upgrade #1763

Merged
merged 7 commits into from
Apr 1, 2023
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
2 changes: 1 addition & 1 deletion cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
TRIBITS_PACKAGE_DEFINE_DEPENDENCIES(
LIB_REQUIRED_PACKAGES KokkosCore KokkosContainers KokkosAlgorithms
LIB_OPTIONAL_TPLS quadmath MKL BLAS LAPACK CUSPARSE METIS SuperLU Cholmod CUBLAS
LIB_OPTIONAL_TPLS quadmath MKL BLAS LAPACK CUSPARSE METIS SuperLU Cholmod CUBLAS ROCBLAS ROCSPARSE
TEST_OPTIONAL_TPLS yaml-cpp
)
# NOTE: If you update names in LIB_OPTIONAL_TPLS above, make sure to map those names in
Expand Down
48 changes: 12 additions & 36 deletions cmake/Modules/FindTPLROCBLAS.cmake
Original file line number Diff line number Diff line change
@@ -1,37 +1,13 @@
IF (ROCBLAS_LIBRARY_DIRS AND ROCBLAS_LIBRARIES)
KOKKOSKERNELS_FIND_IMPORTED(ROCBLAS INTERFACE LIBRARIES ${ROCBLAS_LIBRARIES} LIBRARY_PATHS ${ROCBLAS_LIBRARY_DIRS})
ELSEIF (ROCBLAS_LIBRARIES)
KOKKOSKERNELS_FIND_IMPORTED(ROCBLAS INTERFACE LIBRARIES ${ROCBLAS_LIBRARIES})
ELSEIF (ROCBLAS_LIBRARY_DIRS)
KOKKOSKERNELS_FIND_IMPORTED(ROCBLAS INTERFACE LIBRARIES rocblas LIBRARY_PATHS ${ROCBLAS_LIBRARY_DIRS})
ELSEIF (KokkosKernels_ROCBLAS_ROOT)
KOKKOSKERNELS_FIND_IMPORTED(ROCBLAS INTERFACE
LIBRARIES
rocblas
LIBRARY_PATHS
${KokkosKernels_ROCBLAS_ROOT}/lib
HEADERS
rocblas.h
HEADER_PATHS
${KokkosKernels_ROCBLAS_ROOT}/include
)
ELSEIF (DEFINED ENV{ROCM_PATH})
MESSAGE(STATUS "Detected ROCM_PATH: ENV{ROCM_PATH}")
SET(ROCBLAS_ROOT "$ENV{ROCM_PATH}/rocblas")
KOKKOSKERNELS_FIND_IMPORTED(ROCBLAS INTERFACE
LIBRARIES
rocblas
LIBRARY_PATHS
${ROCBLAS_ROOT}/lib
HEADERS
rocblas.h
HEADER_PATHS
${ROCBLAS_ROOT}/include
)
# MPL: 12/29/2022: CMake regular way to find a package
FIND_PACKAGE(ROCBLAS)
if(TARGET roc::rocblas)
## MPL: 12/29/2022: Variable TPL_ROCBLAS_IMPORTED_NAME follows the requested convention
## of KokkosKernel (method kokkoskernels_import_tpl of kokkoskernels_tpls.cmake)
SET(TPL_ROCBLAS_IMPORTED_NAME roc::rocblas)
SET(TPL_IMPORTED_NAME roc::rocblas)
## MPL: 12/29/2022: A target comming from a TPL must follows the requested convention
## of KokkosKernel (method kokkoskernels_link_tpl of kokkoskernels_tpls.cmake)
ADD_LIBRARY(KokkosKernels::ROCBLAS ALIAS roc::rocblas)
ELSE()
MESSAGE(ERROR "rocBLAS was not detected properly, please disable it or provide sufficient information at configure time.")
# Todo: figure out how to use the target defined during rocblas installation
# FIND_PACKAGE(ROCBLAS REQUIRED)
# KOKKOSKERNELS_CREATE_IMPORTED_TPL(ROCBLAS INTERFACE LINK_LIBRARIES ${ROCBLAS_LIBRARIES})
# GET_TARGET_PROPERTY(ROCBLAS_LINK_LIBRARIES ${ROCBLAS_LIBRARIES} IMPORTED_LINK_INTERFACE_LIBRARIES)
ENDIF()
MESSAGE(FATAL_ERROR "Package ROCBLAS requested but not found")
ENDIF()
44 changes: 8 additions & 36 deletions cmake/Modules/FindTPLROCSPARSE.cmake
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
IF (ROCSPARSE_LIBRARY_DIRS AND ROCSPARSE_LIBRARIES)
KOKKOSKERNELS_FIND_IMPORTED(ROCSPARSE INTERFACE LIBRARIES ${ROCSPARSE_LIBRARIES} LIBRARY_PATHS ${ROCSPARSE_LIBRARY_DIRS})
ELSEIF (ROCSPARSE_LIBRARIES)
KOKKOSKERNELS_FIND_IMPORTED(ROCSPARSE INTERFACE LIBRARIES ${ROCSPARSE_LIBRARIES})
ELSEIF (ROCSPARSE_LIBRARY_DIRS)
KOKKOSKERNELS_FIND_IMPORTED(ROCSPARSE INTERFACE LIBRARIES rocsparse LIBRARY_PATHS ${ROCSPARSE_LIBRARY_DIRS})
ELSEIF (KokkosKernels_ROCSPARSE_ROOT)
KOKKOSKERNELS_FIND_IMPORTED(ROCSPARSE INTERFACE
LIBRARIES
rocsparse
LIBRARY_PATHS
${KokkosKernels_ROCSPARSE_ROOT}/lib
HEADERS
rocsparse.h
HEADER_PATHS
${KokkosKernels_ROCSPARSE_ROOT}/include
)
ELSEIF (DEFINED ENV{ROCM_PATH})
MESSAGE(STATUS "Detected ROCM_PATH: ENV{ROCM_PATH}")
SET(ROCSPARSE_ROOT "$ENV{ROCM_PATH}/rocsparse")
KOKKOSKERNELS_FIND_IMPORTED(ROCSPARSE INTERFACE
LIBRARIES
rocsparse
LIBRARY_PATHS
${ROCSPARSE_ROOT}/lib
HEADERS
rocsparse.h
HEADER_PATHS
${ROCSPARSE_ROOT}/include
)
# MPL: 05/01/2023: This file follows the partern of FindTPLROCBLAS.cmake
FIND_PACKAGE(ROCSPARSE)
if(TARGET roc::rocsparse)
SET(TPL_ROCSPARSE_IMPORTED_NAME roc::rocsparse)
SET(TPL_IMPORTED_NAME roc::rocsparse)
ADD_LIBRARY(KokkosKernels::ROCSPARSE ALIAS roc::rocsparse)
ELSE()
MESSAGE(ERROR "rocSPARSE was not detected properly, please disable it or provide sufficient information at configure time.")
# Todo: figure out how to use the target defined during rocsparse installation
# FIND_PACKAGE(ROCSPARSE REQUIRED)
# KOKKOSKERNELS_CREATE_IMPORTED_TPL(ROCSPARSE INTERFACE LINK_LIBRARIES ${ROCSPARSE_LIBRARIES})
# GET_TARGET_PROPERTY(ROCSPARSE_LINK_LIBRARIES ${ROCSPARSE_LIBRARIES} IMPORTED_LINK_INTERFACE_LIBRARIES)
ENDIF()
MESSAGE(FATAL_ERROR "Package ROCSPARSE requested but not found")
ENDIF()
1 change: 1 addition & 0 deletions sparse/unit_test/Test_Sparse_rocsparse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void test_rocsparse_safe_call() {
void test_rocsparse_singleton() {
KokkosKernels::Impl::RocsparseSingleton& s =
KokkosKernels::Impl::RocsparseSingleton::singleton();
(void)s;
}

TEST_F(TestCategory, sparse_rocsparse_version) { test_rocsparse_version(); }
Expand Down