Skip to content

Commit 64c09d7

Browse files
authored
[FEA] Lanczos solver v2 (#2481)
I unfortunately don't have permissions to push on @aamijar branch for the previous Lanczos solver PR (#2416) so I kept his commits and continued it here. ## Lanczos Solver for Sparse Eigen Decomposition We propose a new lanczos solver in raft that fixes the issues present in the previous solver `raft::sparse::solver::detail::computeSmallestEigenvectors`. Specifically we address the following issues: 1. Numerical Stability for both float32 and float64 datatypes 2. Efficiency and Speed of Convergence This new implementation is taken from the cupy library `cupyx.scipy.sparse.linalg.eigsh` where the thick-restart and full reorthogonalzation methods are used. Additionally this PR exposes a python api for raft lanczos solver with an interface similar to `scipy.sparse.linalg.eigsh` and `cupyx.scipy.sparse.linalg.eigsh`. ```py3 from pylibraft.solver import eigsh ``` Authors: - Micka (https://github.com/lowener) - Anupam (https://github.com/aamijar) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Kyle Edwards (https://github.com/KyleFromNVIDIA) - Corey J. Nolet (https://github.com/cjnolet) URL: #2481
1 parent d8dc72c commit 64c09d7

26 files changed

+2005
-16
lines changed

cpp/CMakeLists.txt

+4
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ if(RAFT_COMPILE_LIBRARY)
268268
src/raft_runtime/random/rmat_rectangular_generator_int64_float.cu
269269
src/raft_runtime/random/rmat_rectangular_generator_int_double.cu
270270
src/raft_runtime/random/rmat_rectangular_generator_int_float.cu
271+
src/raft_runtime/solver/lanczos_solver_int64_double.cu
272+
src/raft_runtime/solver/lanczos_solver_int64_float.cu
273+
src/raft_runtime/solver/lanczos_solver_int_double.cu
274+
src/raft_runtime/solver/lanczos_solver_int_float.cu
271275
)
272276
set_target_properties(
273277
raft_objs

cpp/include/raft/sparse/linalg/detail/cusparse_utils.hpp

+19-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,25 @@ namespace linalg {
3030
namespace detail {
3131

3232
/**
33-
* @brief create a cuSparse dense descriptor
33+
* @brief create a cuSparse dense descriptor for a vector
34+
* @tparam ValueType Data type of vector_view (float/double)
35+
* @tparam IndexType Type of vector_view
36+
* @param[in] vector_view input raft::device_vector_view
37+
* @returns dense vector descriptor to be used by cuSparse API
38+
*/
39+
template <typename ValueType, typename IndexType>
40+
cusparseDnVecDescr_t create_descriptor(raft::device_vector_view<ValueType, IndexType> vector_view)
41+
{
42+
cusparseDnVecDescr_t descr;
43+
RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsecreatednvec(
44+
&descr,
45+
vector_view.extent(0),
46+
const_cast<std::remove_const_t<ValueType>*>(vector_view.data_handle())));
47+
return descr;
48+
}
49+
50+
/**
51+
* @brief create a cuSparse dense descriptor for a matrix
3452
* @tparam ValueType Data type of dense_view (float/double)
3553
* @tparam IndexType Type of dense_view
3654
* @tparam LayoutPolicy layout of dense_view

0 commit comments

Comments
 (0)