Skip to content

Commit

Permalink
Merge pull request #1808 from ndellingwood/master
Browse files Browse the repository at this point in the history
Release 4.0.01
  • Loading branch information
lucbv authored May 1, 2023
2 parents b9c1bab + c208dac commit 1331baf
Show file tree
Hide file tree
Showing 40 changed files with 930 additions and 382 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
.project
*.o
TAGS

#Clangd indexing
compile_commands.json
.cache/
.vscode/
28 changes: 26 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,31 @@
# Change Log

## [4.0.0](https://github.com/kokkos/kokkos-kernels/tree/4.0.0) (2023-21-02)
[Full Changelog](https://github.com/kokkos/kokkos-kernels/compare/3.7.01...4.0.0)
## [4.0.01](https://github.com/kokkos/kokkos-kernels/tree/4.0.01) (2023-04-19)
[Full Changelog](https://github.com/kokkos/kokkos-kernels/compare/4.0.00...4.0.01)

### Bug Fixes:
- Use the options ENABLE_PERFTEST, ENABLE_EXAMPLES [\#1667](https://github.com/kokkos/kokkos-kernels/pull/1667)
- Introduce KOKKOSKERNELS_ALL_COMPONENTS_ENABLED variable [\#1691](https://github.com/kokkos/kokkos-kernels/pull/1691)
- Kokkos Kernels version: need to use upper case variables [\#1707](https://github.com/kokkos/kokkos-kernels/pull/1707)
- CUSPARSE_MM_ALG_DEFAULT deprecated by cuSparse 11.1 [\#1698](https://github.com/kokkos/kokkos-kernels/pull/1698)
- blas1: Fix a couple documentation typos [\#1704](https://github.com/kokkos/kokkos-kernels/pull/1704)
- CUDA 11.4: fixing some -Werror [\#1727](https://github.com/kokkos/kokkos-kernels/pull/1727)
- Remove unused variable in KokkosSparse_spgemm_numeric_tpl_spec_decl.hpp [\#1734](https://github.com/kokkos/kokkos-kernels/pull/1734)
- Reduce BatchedGemm test coverage time [\#1737](https://github.com/kokkos/kokkos-kernels/pull/1737)
- Fix kk_generate_diagonally_dominant_sparse_matrix hang [\#1689](https://github.com/kokkos/kokkos-kernels/pull/1689)
- Temporary spgemm workaround matching Trilinos 11663 [\#1757](https://github.com/kokkos/kokkos-kernels/pull/1757)
- MDF: Minor changes to interface for ifpack2 impl [\#1759](https://github.com/kokkos/kokkos-kernels/pull/1759)
- Rocm TPL support upgrade [\#1763](https://github.com/kokkos/kokkos-kernels/pull/1763)
- Fix BLAS cmake check for complex types [\#1762](https://github.com/kokkos/kokkos-kernels/pull/1762)
- ParIlut: Adds a better parilut test with gmres [\#1661](https://github.com/kokkos/kokkos-kernels/pull/1661)
- GMRES: fixing some type issues related to memory space instantiation (partial) [\#1719](https://github.com/kokkos/kokkos-kernels/pull/1719)
- ParIlut: create and destroy spgemm handle for each usage [\#1736](https://github.com/kokkos/kokkos-kernels/pull/1736)
- ParIlut: remove par ilut limitations [\#1755](https://github.com/kokkos/kokkos-kernels/pull/1755)
- ParIlut: make Ut_values view atomic in compute_l_u_factors [\#1781](https://github.com/kokkos/kokkos-kernels/pull/1781)


## [4.0.0](https://github.com/kokkos/kokkos-kernels/tree/4.0.00) (2023-21-02)
[Full Changelog](https://github.com/kokkos/kokkos-kernels/compare/3.7.01...4.0.00)

### Features:
- Copyright update 4.0 [\#1657](https://github.com/kokkos/kokkos-kernels/pull/1657)
Expand Down
29 changes: 22 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SET(KOKKOSKERNELS_TOP_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

SET(KokkosKernels_VERSION_MAJOR 4)
SET(KokkosKernels_VERSION_MINOR 0)
SET(KokkosKernels_VERSION_PATCH 0)
SET(KokkosKernels_VERSION_PATCH 1)
SET(KokkosKernels_VERSION "${KokkosKernels_VERSION_MAJOR}.${KokkosKernels_VERSION_MINOR}.${KokkosKernels_VERSION_PATCH}")

#Set variables for config file
Expand Down Expand Up @@ -70,7 +70,7 @@ IF (NOT KOKKOSKERNELS_HAS_TRILINOS)
)
KOKKOSKERNELS_ADD_OPTION(
"ENABLE_PERFTESTS"
ON
OFF
BOOL
"Whether to build performance tests. Default: OFF"
)
Expand Down Expand Up @@ -221,7 +221,7 @@ ELSE()
# ==================================================================
MESSAGE("")
MESSAGE("================================")
MESSAGE("Kokkos Kernels version: ${KokkosKernels_VERSION_MAJOR}.${KokkosKernels_VERSION_MINOR}.${KokkosKernels_VERSION_PATCH}")
MESSAGE("Kokkos Kernels version: ${KOKKOSKERNELS_VERSION_MAJOR}.${KOKKOSKERNELS_VERSION_MINOR}.${KOKKOSKERNELS_VERSION_PATCH}")
MESSAGE("================================")
MESSAGE("Kokkos Kernels ETI Types")
MESSAGE(" Devices: ${DEVICE_LIST}")
Expand Down Expand Up @@ -390,10 +390,25 @@ ELSE()
IF (KokkosKernels_ENABLE_COMPONENT_SPARSE)
KOKKOSKERNELS_ADD_TEST_DIRECTORIES(sparse/unit_test)
ENDIF()
IF (KokkosKernels_ENABLE_ALL_COMPONENTS)
KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test)
KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example)
ENDIF()
IF (KOKKOSKERNELS_ALL_COMPONENTS_ENABLED)
IF (KokkosKernels_ENABLE_PERFTESTS)
MESSAGE(STATUS "Enabling perf tests.")
KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test)
ENDIF ()
IF (KokkosKernels_ENABLE_EXAMPLES)
MESSAGE(STATUS "Enabling examples.")
KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example)
ENDIF ()
ELSE ()
# all components were not enabled, so perftests and examples can't be enabled.
# Warn if they were requested.
IF (KokkosKernels_ENABLE_PERFTESTS)
MESSAGE(WARNING "Could not enable perf tests because not all components were enabled")
ENDIF ()
IF (KokkosKernels_ENABLE_EXAMPLES)
MESSAGE(WARNING "Could not enable examples because not all components were enabled")
ENDIF ()
ENDIF ()

KOKKOSKERNELS_PACKAGE_POSTPROCESS()
IF (KokkosKernels_ENABLE_DOCS)
Expand Down
20 changes: 15 additions & 5 deletions CheckHostBlasReturnComplex.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ FUNCTION(CHECK_HOST_BLAS_RETURN_COMPLEX VARNAME)
#define F77_BLAS_MANGLE${F77_BLAS_MANGLE}
extern \"C\" {
std::complex<double> F77_BLAS_MANGLE(zdotc,ZDOTC)(
const int* n,
void F77_BLAS_MANGLE(zdotc,ZDOTC)(
std::complex<double>* result, const int* n,
const std::complex<double> x[], const int* incx,
const std::complex<double> y[], const int* incy);
}
Expand All @@ -35,13 +35,23 @@ int main() {
TWO = std::complex<double>(0.0,2.0);
f[0] = ONE;
f[1] = TWO;
std::complex<double> ret
= F77_BLAS_MANGLE(zdotc,ZDOTC)(&NUM, f, &INC, f, &INC);
std::complex<double> ret;
F77_BLAS_MANGLE(zdotc,ZDOTC)(&ret, &NUM, f, &INC, f, &INC);
return (ret.real() == double(5.0) ? 0 : 1);
}
"
)

CHECK_CXX_SOURCE_RUNS("${SOURCE}" ${VARNAME})
# Test whether the above program, which assumes BLAS can give back complex results
# via pointer arguments, compiles and runs correctly.
# If it does, assume that we don't need to get complex results as direct return values,
# which causes -Wreturn-type-c-linkage warnings.
CHECK_CXX_SOURCE_RUNS("${SOURCE}" KK_BLAS_RESULT_AS_POINTER_ARG)

IF(${KK_BLAS_RESULT_AS_POINTER_ARG})
SET(VARNAME OFF)
ELSE()
SET(VARNAME ON)
ENDIF()

ENDFUNCTION()
17 changes: 10 additions & 7 deletions batched/dense/unit_test/Test_Batched_BatchedGemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,15 @@ void impl_test_batched_gemm(const int N, const int matAdim1, const int matAdim2,

ASSERT_EQ(batchedGemmHandle.get_kernel_algo_type(), algo_type);

if (algo_type == BaseHeuristicAlgos::SQUARE ||
algo_type == BaseTplAlgos::ARMPL ||
if (algo_type == BaseTplAlgos::ARMPL ||
algo_type == BaseKokkosBatchedAlgos::KK_SERIAL ||
algo_type == GemmKokkosBatchedAlgos::KK_SERIAL_RANK0 ||
algo_type == GemmKokkosBatchedAlgos::KK_DBLBUF) {
impl_test_batched_gemm_with_handle<DeviceType, ViewType, ScalarType,
ParamTagType>(
&batchedGemmHandle, N, matAdim1, matAdim2, matBdim1, matBdim2,
matCdim1, matCdim2, 1.5, 3.0);
} else if (algo_type == BaseHeuristicAlgos::SQUARE) {
// Invoke 4 times to ensure we cover all paths for alpha and beta
impl_test_batched_gemm_with_handle<DeviceType, ViewType, ScalarType,
ParamTagType>(
Expand Down Expand Up @@ -316,13 +320,12 @@ template <typename ViewType, typename DeviceType, typename ValueType,
typename ScalarType, typename ParamTagType>
void test_batched_gemm_with_layout(int N) {
// Square cases
for (int i = 0; i < 5; ++i) {
{
int i = 0;
Test::impl_test_batched_gemm<DeviceType, ViewType, ScalarType,
ParamTagType>(N, i, i, i, i, i, i);
}

{
int i = 10;
i = 10;
Test::impl_test_batched_gemm<DeviceType, ViewType, ScalarType,
ParamTagType>(N, i, i, i, i, i, i);

Expand All @@ -336,7 +339,7 @@ void test_batched_gemm_with_layout(int N) {
}

// Non-square cases
for (int i = 0; i < 5; ++i) {
for (int i = 1; i < 5; ++i) {
int dimM = 1 * i;
int dimN = 2 * i;
int dimK = 3 * i;
Expand Down
14 changes: 14 additions & 0 deletions blas/src/KokkosBlas1_mult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,20 @@

namespace KokkosBlas {

/// \brief Element wise multiplication of two vectors:
/// Y[i] = gamma * Y[i] + alpha * A[i] * X[i]
///
/// \tparam YMV Type of the first vector Y; a 1-D or 2-D Kokkos::View.
/// \tparam AV Type of the second vector A; a 1-D Kokkos::View.
/// \tparam XMV Type of the third vector X; a 1-D or 2-D Kokkos::View.
///
/// \param gamma [in] The scalar to apply to Y.
/// \param Y [in/out] The Y vector.
/// \param alpha [in] The scalar to apply to A.
/// \param A [in] The vector to apply to X.
/// \param X [in] The X vector.
///
/// \return Y = gamma * Y + alpha * A * X.
template <class YMV, class AV, class XMV>
void mult(typename YMV::const_value_type& gamma, const YMV& Y,
typename AV::const_value_type& alpha, const AV& A, const XMV& X) {
Expand Down
2 changes: 1 addition & 1 deletion blas/src/KokkosBlas1_nrm2w.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ nrm2w(const XVector& x, const XVector& w) {

/// \brief R(i,j) = nrm2w(X(i,j))
///
/// Replace each entry in R with the nrm2wolute value (magnitude) of the
/// Replace each entry in R with the nrm2w, absolute value (magnitude), of the
/// corresponding entry in X.
///
/// \tparam RMV 1-D or 2-D Kokkos::View specialization.
Expand Down
4 changes: 2 additions & 2 deletions blas/src/KokkosBlas1_reciprocal.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ namespace KokkosBlas {

/// \brief R(i,j) = reciprocal(X(i,j))
///
/// Replace each entry in R with the reciprocalolute value (magnitude) of the
/// corresponding entry in X.
/// Replace each entry in R with the absolute value (magnitude), of the
/// reciprocal of the corresponding entry in X.
///
/// \tparam RMV 1-D or 2-D Kokkos::View specialization.
/// \tparam XMV 1-D or 2-D Kokkos::View specialization. It must have
Expand Down
5 changes: 3 additions & 2 deletions blas/src/KokkosBlas3_trsm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ namespace KokkosBlas {
/// "L" or "l" indicates matrix A lower part is stored, the
/// other part is not referenced
/// \param trans [in] "N" or "n" for non-transpose, "T" or "t" for transpose,
/// "C" or "c" for conjugate transpose. \param diag [in] "U" or "u" indicates
/// the diagonal of A is assumed to be unit
/// "C" or "c" for conjugate transpose.
/// \param diag [in] "U" or "u" indicates the diagonal of A is assumed to be
/// unit
// "N" or "n" indicated the diagonal of A is assumed to be
// non-unit
/// \param alpha [in] Input coefficient used for multiplication with B
Expand Down
12 changes: 8 additions & 4 deletions cm_generate_makefile.bash
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,7 @@ display_help_text() {
echo "--disable-perftests: Do not build Kokkos Kernels performance tests"
echo "--enable-perftests: build Kokkos Kernels performance tests (default)"
echo "--deprecated-code Enable deprecated code (disabled by default)"
echo "--enable-perfsuite: build Kokkos Kernels performance tests with
RAJAPerf Suite"
echo "--export-compile-commands: export cmake compile_commands.json file"


}
Expand All @@ -381,6 +380,8 @@ KOKKOSKERNELS_DO_PERFTESTS=ON
KOKKOSKERNELS_DO_PERFSUITE=OFF
KOKKOSKERNELS_DO_EXAMPLES=ON

CMAKE_EXPORT_COMPILE_COMMANDS=OFF

#Build static libraries by default
BUILD_SHARED_LIBRARIES=OFF

Expand Down Expand Up @@ -539,6 +540,9 @@ do
# This is the default
KOKKOSKERNELS_DO_TESTS=ON
;;
--export-compile-commands)
CMAKE_EXPORT_COMPILE_COMMANDS=ON
;;
--enable-perfsuite)
KOKKOSKERNELS_DO_PERFSUITE=ON
;;
Expand Down Expand Up @@ -812,6 +816,6 @@ cd $STORE_KOKKOSKERNELS_BUILD_PATH

# Configure kokkos-kernels
echo ""
echo cmake $COMPILER_CMD -DKokkos_DIR="${KOKKOS_FIND_PATH}" -DCMAKE_CXX_FLAGS=\"${KOKKOS_CXXFLAGS}\" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE=${KOKKOSKERNELS_DO_PERFSUITE} -DKokkosKernels_ENABLE_TESTS=${KOKKOSKERNELS_DO_TESTS} -DKokkosKernels_ENABLE_PERFTESTS=${KOKKOSKERNELS_DO_PERFTESTS} -DKokkosKernels_ENABLE_EXAMPLES:BOOL=${KOKKOSKERNELS_DO_EXAMPLES} ${KOKKOSKERNELS_SCALARS_CMD} ${KOKKOSKERNELS_ORDINALS_CMD} ${KOKKOSKERNELS_OFFSETS_CMD} ${KOKKOSKERNELS_LAYOUTS_CMD} ${KOKKOSKERNELS_TPLS_CMD} ${KOKKOSKERNELS_USER_TPL_PATH_CMD} ${KOKKOSKERNELS_USER_TPL_LIBNAME_CMD} -DCMAKE_EXE_LINKER_FLAGS=\"${KOKKOSKERNELS_EXTRA_LINKER_FLAGS_PARSED}\" ${KOKKOSKERNELS_BUILDTYPE_CMD} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES} ${KOKKOSKERNELS_COMPONENTS_CMD} ${KOKKOSKERNELS_SPACES_CMD} ${KERNELS_DEFAULT_ETI_OPTION} ${KOKKOSKERNELS_PATH}
echo cmake $COMPILER_CMD -DKokkos_DIR="${KOKKOS_FIND_PATH}" -DCMAKE_CXX_FLAGS=\"${KOKKOS_CXXFLAGS}\" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE=${KOKKOSKERNELS_DO_PERFSUITE} -DKokkosKernels_ENABLE_TESTS=${KOKKOSKERNELS_DO_TESTS} -DKokkosKernels_ENABLE_PERFTESTS=${KOKKOSKERNELS_DO_PERFTESTS} -DKokkosKernels_ENABLE_EXAMPLES:BOOL=${KOKKOSKERNELS_DO_EXAMPLES} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=${CMAKE_EXPORT_COMPILE_COMMANDS} ${KOKKOSKERNELS_SCALARS_CMD} ${KOKKOSKERNELS_ORDINALS_CMD} ${KOKKOSKERNELS_OFFSETS_CMD} ${KOKKOSKERNELS_LAYOUTS_CMD} ${KOKKOSKERNELS_TPLS_CMD} ${KOKKOSKERNELS_USER_TPL_PATH_CMD} ${KOKKOSKERNELS_USER_TPL_LIBNAME_CMD} -DCMAKE_EXE_LINKER_FLAGS=\"${KOKKOSKERNELS_EXTRA_LINKER_FLAGS_PARSED}\" ${KOKKOSKERNELS_BUILDTYPE_CMD} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES} ${KOKKOSKERNELS_COMPONENTS_CMD} ${KOKKOSKERNELS_SPACES_CMD} ${KERNELS_DEFAULT_ETI_OPTION} ${KOKKOSKERNELS_PATH}
echo ""
cmake $COMPILER_CMD -DKokkos_DIR="${KOKKOS_FIND_PATH}" -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE=${KOKKOSKERNELS_DO_PERFSUITE} -DKokkosKernels_ENABLE_TESTS=${KOKKOSKERNELS_DO_TESTS} -DKokkosKernels_ENABLE_PERFTESTS=${KOKKOSKERNELS_DO_PERFTESTS} -DKokkosKernels_ENABLE_EXAMPLES:BOOL=${KOKKOSKERNELS_DO_EXAMPLES} ${KOKKOSKERNELS_SCALARS_CMD} ${KOKKOSKERNELS_ORDINALS_CMD} ${KOKKOSKERNELS_OFFSETS_CMD} ${KOKKOSKERNELS_LAYOUTS_CMD} ${KOKKOSKERNELS_TPLS_CMD} ${KOKKOSKERNELS_USER_TPL_PATH_CMD} ${KOKKOSKERNELS_USER_TPL_LIBNAME_CMD} -DCMAKE_EXE_LINKER_FLAGS="${KOKKOSKERNELS_EXTRA_LINKER_FLAGS_PARSED//\"}" ${KOKKOSKERNELS_BUILDTYPE_CMD} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES} ${KOKKOSKERNELS_COMPONENTS_CMD} ${KOKKOSKERNELS_SPACES_CMD} ${KERNELS_DEFAULT_ETI_OPTION} ${KOKKOSKERNELS_PATH}
cmake $COMPILER_CMD -DKokkos_DIR="${KOKKOS_FIND_PATH}" -DCMAKE_CXX_FLAGS="${KOKKOS_CXXFLAGS//\"}" -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DKokkosKernels_ENABLE_TESTS_AND_PERFSUITE=${KOKKOSKERNELS_DO_PERFSUITE} -DKokkosKernels_ENABLE_TESTS=${KOKKOSKERNELS_DO_TESTS} -DKokkosKernels_ENABLE_PERFTESTS=${KOKKOSKERNELS_DO_PERFTESTS} -DKokkosKernels_ENABLE_EXAMPLES:BOOL=${KOKKOSKERNELS_DO_EXAMPLES} -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=${CMAKE_EXPORT_COMPILE_COMMANDS} ${KOKKOSKERNELS_SCALARS_CMD} ${KOKKOSKERNELS_ORDINALS_CMD} ${KOKKOSKERNELS_OFFSETS_CMD} ${KOKKOSKERNELS_LAYOUTS_CMD} ${KOKKOSKERNELS_TPLS_CMD} ${KOKKOSKERNELS_USER_TPL_PATH_CMD} ${KOKKOSKERNELS_USER_TPL_LIBNAME_CMD} -DCMAKE_EXE_LINKER_FLAGS="${KOKKOSKERNELS_EXTRA_LINKER_FLAGS_PARSED//\"}" ${KOKKOSKERNELS_BUILDTYPE_CMD} -DBUILD_SHARED_LIBS=${BUILD_SHARED_LIBRARIES} ${KOKKOSKERNELS_COMPONENTS_CMD} ${KOKKOSKERNELS_SPACES_CMD} ${KERNELS_DEFAULT_ETI_OPTION} ${KOKKOSKERNELS_PATH}
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()
Loading

0 comments on commit 1331baf

Please sign in to comment.