Skip to content

Commit

Permalink
[FEA] Lanczos solver v2 (#2481)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
lowener authored Nov 20, 2024
1 parent d8dc72c commit 64c09d7
Show file tree
Hide file tree
Showing 26 changed files with 2,005 additions and 16 deletions.
4 changes: 4 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ if(RAFT_COMPILE_LIBRARY)
src/raft_runtime/random/rmat_rectangular_generator_int64_float.cu
src/raft_runtime/random/rmat_rectangular_generator_int_double.cu
src/raft_runtime/random/rmat_rectangular_generator_int_float.cu
src/raft_runtime/solver/lanczos_solver_int64_double.cu
src/raft_runtime/solver/lanczos_solver_int64_float.cu
src/raft_runtime/solver/lanczos_solver_int_double.cu
src/raft_runtime/solver/lanczos_solver_int_float.cu
)
set_target_properties(
raft_objs
Expand Down
20 changes: 19 additions & 1 deletion cpp/include/raft/sparse/linalg/detail/cusparse_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,25 @@ namespace linalg {
namespace detail {

/**
* @brief create a cuSparse dense descriptor
* @brief create a cuSparse dense descriptor for a vector
* @tparam ValueType Data type of vector_view (float/double)
* @tparam IndexType Type of vector_view
* @param[in] vector_view input raft::device_vector_view
* @returns dense vector descriptor to be used by cuSparse API
*/
template <typename ValueType, typename IndexType>
cusparseDnVecDescr_t create_descriptor(raft::device_vector_view<ValueType, IndexType> vector_view)
{
cusparseDnVecDescr_t descr;
RAFT_CUSPARSE_TRY(raft::sparse::detail::cusparsecreatednvec(
&descr,
vector_view.extent(0),
const_cast<std::remove_const_t<ValueType>*>(vector_view.data_handle())));
return descr;
}

/**
* @brief create a cuSparse dense descriptor for a matrix
* @tparam ValueType Data type of dense_view (float/double)
* @tparam IndexType Type of dense_view
* @tparam LayoutPolicy layout of dense_view
Expand Down
Loading

0 comments on commit 64c09d7

Please sign in to comment.