A C++ library with Python bindings for efficient similarity search and clustering of dense vectors, with optional GPU acceleration.
NVIDIA/raft
CUDA-accelerated C++ header-only library and Python wrappers of reusable primitives for machine learning, linear algebra, and information retrieval on NVIDIA GPUs.
- Stars
- 1,051
- Forks
- 256
- Open issues
- 446
- Last commit
- yesterday
What is it?
RAFT is a library of fundamental algorithms and primitives for machine learning and information retrieval, with CUDA-accelerated implementations intended as building blocks for high-performance GPU applications. It covers dense and sparse linear algebra, solvers, statistics and sampling, distance computations, and data format conversions, and it includes multi-node multi-GPU communication infrastructure.
RAFT is a C++ header-only template library with an optional shared library that can reduce compile times for common template types and exposes host-callable runtime APIs that do not need a CUDA compiler. Memory is managed through CCCL or NVIDIA RMM resources, and inputs use mdspan views with an owning mdarray layer. Python users get the pylibraft package, which wraps the runtime APIs and accepts any object supporting __cuda_array_interface__, and raft-dask, which builds distributed GPU algorithms on Dask clusters.
RAFT targets developers building libraries and applications rather than data scientists doing exploratory analysis. Packages are distributed through Conda and, in experimental form, through pip for CUDA 12 and 13.
Key features
- 01Header-only C++ template library with an optional shared library for faster compile times.
- 02Host-callable runtime APIs that do not require a CUDA compiler.
- 03Dense and sparse linear algebra, solvers, and statistics primitives.
- 04Python wrappers via pylibraft that interoperate with CuPy, PyTorch, Numba, and cuDF.
- 05Multi-node multi-GPU communication through raft-dask on Dask clusters.
Use cases
- Building GPU-accelerated vector search or nearest-neighbor components inside a larger system.
- Writing custom CUDA algorithms that reuse tested linear algebra and reduction primitives.
- Running distributed GPU algorithms across multiple nodes with Dask.
- Calling GPU primitives from Python without writing CUDA code.
Quick start
- 1
Install RAFT via conda (CUDA 13)
mamba install -c rapidsai -c conda-forge raft-dask pylibraft cuda-version=13.3 - 2
Or install pylibraft via pip (CUDA 12)
pip install pylibraft-cu12
Things to know
- Requires an NVIDIA GPU with CUDA; it is not usable on CPU-only machines.
- Intended for low-level primitives rather than direct data science use.
- The pip packages are experimental and do not include C++ headers.
In collections
Topics
FAQ
- What is raft?
- CUDA-accelerated C++ header-only library and Python wrappers of reusable primitives for machine learning, linear algebra, and information retrieval on NVIDIA GPUs. RAFT is a library of fundamental algorithms and primitives for machine learning and information retrieval, with CUDA-accelerated implementations intended as building blocks for high-performance GPU applications. It covers dense and sparse linear algebra, solvers, statistics and sampling, distance computations, and data format conversions, and it includes multi-node multi-GPU communication infrastructure.
- Is raft free to use? What license does it have?
- raft is open source under the Apache-2.0 license. Check the license terms before using it in commercial products.
- Is raft still maintained?
- Actively maintained. The last commit to raft was on Nov 5, 2026.
- What can I use raft for?
- Building GPU-accelerated vector search or nearest-neighbor components inside a larger system. Writing custom CUDA algorithms that reuse tested linear algebra and reduction primitives. Running distributed GPU algorithms across multiple nodes with Dask. Calling GPU primitives from Python without writing CUDA code.
- How do I install raft?
- Install RAFT via conda (CUDA 13): mamba install -c rapidsai -c conda-forge raft-dask pylibraft cuda-version=13.3 Or install pylibraft via pip (CUDA 12): pip install pylibraft-cu12
- Where can I get raft?
- The source code and installation instructions are on GitHub: https://github.com/NVIDIA/raft
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
CUDA C++ template library and Python DSL for writing high-performance GEMM and related linear algebra kernels on NVIDIA GPUs.
A C++20 header-only library for NumPy-style tensor expressions that run on NVIDIA GPUs or multithreaded CPUs, with optional kernel fusion.
A fast, ergonomic N-dimensional tensor library in Nim with CPU, CUDA and OpenCL backends, aimed at numerical computing and deep learning.
A Python library for fast CPU clustering of large high-dimensional embedding vectors, with a scikit-learn style API.
A C++ library and command-line tool for fast approximate nearest neighbor search over high-dimensional vectors, using graph and tree indexes.