Skip to content

Commit

Permalink
Link cuVS Docs (#4084)
Browse files Browse the repository at this point in the history
Summary:
Small updates to the ReadMe files. More detailed description in a follow up PR for the wiki.

Remove the cuvs conda CI checks

Pull Request resolved: #4084

Reviewed By: mengdilin

Differential Revision: D67602013

Pulled By: mnorris11

fbshipit-source-id: f7c40440d278f00195bcad2dbdd2187325f40662
  • Loading branch information
tarang-jain authored and facebook-github-bot committed Dec 23, 2024
1 parent 3beb07b commit ab8cb9c
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 41 deletions.
30 changes: 0 additions & 30 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,36 +143,6 @@ jobs:
fetch-tags: true
- name: Build and Package (conda)
uses: ./.github/actions/build_conda
linux-x86_64-GPU-CUVS-CUDA11-8-0-conda:
name: Linux x86_64 GPU w/ cuVS conda (CUDA 11.8.0)
runs-on: 4-core-ubuntu-gpu-t4
env:
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: ./.github/actions/build_conda
with:
cuvs: "ON"
cuda: "11.8.0"
linux-x86_64-GPU-CUVS-CUDA12-4-0-conda:
name: Linux x86_64 GPU w/ cuVS conda (CUDA 12.4.0)
runs-on: 4-core-ubuntu-gpu-t4
env:
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-tags: true
- uses: ./.github/actions/build_conda
with:
cuvs: "ON"
cuda: "12.4.0"
windows-x86_64-conda:
name: Windows x86_64 (conda)
needs: linux-x86_64-cmake
Expand Down
39 changes: 29 additions & 10 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pre-release nightly builds.

- The CPU-only faiss-cpu conda package is currently available on Linux (x86-64 and aarch64), OSX (arm64 only), and Windows (x86-64)
- faiss-gpu, containing both CPU and GPU indices, is available on Linux (x86-64 only) for CUDA 11.4 and 12.1
- faiss-gpu-raft containing both CPU and GPU indices provided by NVIDIA RAFT, is available on Linux (x86-64 only) for CUDA 11.8 and 12.1.
- faiss-gpu-raft [^1] package containing GPU indices provided by [NVIDIA RAFT](https://github.com/rapidsai/raft/) version 24.06, is available on Linux (x86-64 only) for CUDA 11.8 and 12.4.

To install the latest stable release:

Expand All @@ -23,10 +23,9 @@ $ conda install -c pytorch -c nvidia -c rapidsai -c conda-forge faiss-gpu-raft=1
# GPU(+CPU) version using AMD ROCm not yet available
```

For faiss-gpu, the nvidia channel is required for CUDA, which is not
published in the main anaconda channel.
For faiss-gpu, the nvidia channel is required for CUDA, which is not published in the main anaconda channel.

For faiss-gpu-raft, the nvidia, rapidsai and conda-forge channels are required.
For faiss-gpu-raft, the rapidsai, conda-forge and nvidia channels are required.

Nightly pre-release packages can be installed as follows:

Expand All @@ -37,8 +36,11 @@ $ conda install -c pytorch/label/nightly faiss-cpu
# GPU(+CPU) version
$ conda install -c pytorch/label/nightly -c nvidia faiss-gpu=1.9.0

# GPU(+CPU) version with NVIDIA RAFT
conda install -c pytorch -c nvidia -c rapidsai -c conda-forge faiss-gpu-raft=1.9.0 pytorch pytorch-cuda numpy
# GPU(+CPU) version with NVIDIA cuVS (package built with CUDA 12.4)
conda install -c pytorch -c rapidsai -c conda-forge -c nvidia pytorch/label/nightly::faiss-gpu-cuvs 'cuda-version>=12.0,<=12.5'

# GPU(+CPU) version with NVIDIA cuVS (package built with CUDA 11.8)
conda install -c pytorch -c rapidsai -c conda-forge -c nvidia pytorch/label/nightly::faiss-gpu-cuvs 'cuda-version>=11.4,<=11.8'

# GPU(+CPU) version using AMD ROCm not yet available
```
Expand Down Expand Up @@ -68,7 +70,7 @@ $ conda install -c conda-forge faiss-cpu
# GPU version
$ conda install -c conda-forge faiss-gpu

# AMD ROCm version not yet available
# NVIDIA cuVS and AMD ROCm version not yet available
```

You can tell which channel your conda packages come from by using `conda list`.
Expand All @@ -95,6 +97,8 @@ The optional requirements are:
- the CUDA toolkit,
- for AMD GPUs:
- AMD ROCm,
- for using NVIDIA cuVS implementations:
- libcuvs=24.12
- for the python bindings:
- python 3,
- numpy,
Expand All @@ -103,6 +107,19 @@ The optional requirements are:
Indications for specific configurations are available in the [troubleshooting
section of the wiki](https://github.com/facebookresearch/faiss/wiki/Troubleshooting).

### Building with NVIDIA cuVS

The libcuvs dependency should be installed via conda:
1. With CUDA 12.0 - 12.5:
```
conda install -c rapidsai -c conda-forge -c nvidia libcuvs=24.12 'cuda-version>=12.0,<=12.5'
```
2. With CUDA 11.4 - 11.8
```
conda install -c rapidsai -c conda-forge -c nvidia libcuvs=24.12 'cuda-version>=11.4,<=11.8'
```
For more ways to install cuVS 24.12, refer to the [RAPIDS Installation Guide](https://docs.rapids.ai/install).

## Step 1: invoking CMake

``` shell
Expand All @@ -118,9 +135,9 @@ Several options can be passed to CMake, among which:
values are `ON` and `OFF`),
- `-DFAISS_ENABLE_PYTHON=OFF` in order to disable building python bindings
(possible values are `ON` and `OFF`),
- `-DFAISS_ENABLE_CUVS=ON` in order to enable building the cuVS implementations
of the IVF-Flat and IVF-PQ GPU-accelerated indices (default is `OFF`, possible
values are `ON` and `OFF`)
- `-DFAISS_ENABLE_CUVS=ON` in order to use the NVIDIA cuVS implementations
of the IVF-Flat, IVF-PQ and [CAGRA](https://arxiv.org/pdf/2308.15136) GPU-accelerated indices (default is `OFF`, possible, values are `ON` and `OFF`).
Note: `-DFAISS_ENABLE_GPU` must be set to `ON` when enabling this option.
- `-DBUILD_TESTING=OFF` in order to disable building C++ tests,
- `-DBUILD_SHARED_LIBS=ON` in order to build a shared library (possible values
are `ON` and `OFF`),
Expand Down Expand Up @@ -302,3 +319,5 @@ and you can run
$ python demos/demo_auto_tune.py
```
to test the GPU code.

[^1]: The vector search and clustering algorithms in NVIDIA RAFT have been formally migrated to [NVIDIA cuVS](https://github.com/rapidsai/cuvs). This package is being renamed to `faiss-gpu-cuvs` in the next stable release, which will use these GPU implementations from the pre-compiled `libcuvs=24.12` binary.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The GPU implementation can accept input from either CPU or GPU memory. On a serv

## Installing

Faiss comes with precompiled libraries for Anaconda in Python, see [faiss-cpu](https://anaconda.org/pytorch/faiss-cpu) and [faiss-gpu](https://anaconda.org/pytorch/faiss-gpu). The library is mostly implemented in C++, the only dependency is a [BLAS](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) implementation. Optional GPU support is provided via CUDA or AMD ROCm, and the Python interface is also optional. It compiles with cmake. See [INSTALL.md](INSTALL.md) for details.
Faiss comes with precompiled libraries for Anaconda in Python, see [faiss-cpu](https://anaconda.org/pytorch/faiss-cpu), [faiss-gpu](https://anaconda.org/pytorch/faiss-gpu) and [faiss-gpu-cuvs](https://anaconda.org/pytorch/faiss-gpu-cuvs). The library is mostly implemented in C++, the only dependency is a [BLAS](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) implementation. Optional GPU support is provided via CUDA or AMD ROCm, and the Python interface is also optional. The backend GPU implementations of NVIDIA [cuVS](https://github.com/rapidsai/cuvs) can also be enabled optionally. It compiles with cmake. See [INSTALL.md](INSTALL.md) for details.

## How Faiss works

Expand Down
2 changes: 2 additions & 0 deletions faiss/gpu/impl/CuvsIVFFlat.cu
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ void CuvsIVFFlat::searchPreassigned(
Tensor<idx_t, 2, true>& outIndices,
bool storePairs) {
// TODO: Fill this in!
// Reference issue: https://github.com/facebookresearch/faiss/issues/3243
FAISS_THROW_MSG("searchPreassigned is not implemented for cuVS index");
}

void CuvsIVFFlat::updateQuantizer(Index* quantizer) {
Expand Down
2 changes: 2 additions & 0 deletions faiss/gpu/impl/CuvsIVFPQ.cu
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ void CuvsIVFPQ::searchPreassigned(
Tensor<idx_t, 2, true>& outIndices,
bool storePairs) {
// TODO: Fill this in!
// Reference issue: https://github.com/facebookresearch/faiss/issues/3243
FAISS_THROW_MSG("searchPreassigned is not implemented for cuVS index");
}

size_t CuvsIVFPQ::getGpuListEncodingSize_(idx_t listId) {
Expand Down

0 comments on commit ab8cb9c

Please sign in to comment.