diff --git a/.github/workflows/build-pull-request.yml b/.github/workflows/build-pull-request.yml index b312c71d37..bc0d2d625a 100644 --- a/.github/workflows/build-pull-request.yml +++ b/.github/workflows/build-pull-request.yml @@ -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 diff --git a/INSTALL.md b/INSTALL.md index c5f76d47d5..26b51a80b1 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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: @@ -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: @@ -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 ``` @@ -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`. @@ -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, @@ -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 @@ -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`), @@ -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. diff --git a/README.md b/README.md index f00f4d7a3c..468ba59ab6 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/faiss/gpu/impl/CuvsIVFFlat.cu b/faiss/gpu/impl/CuvsIVFFlat.cu index 0de7100c72..2cccee8605 100644 --- a/faiss/gpu/impl/CuvsIVFFlat.cu +++ b/faiss/gpu/impl/CuvsIVFFlat.cu @@ -291,6 +291,8 @@ void CuvsIVFFlat::searchPreassigned( Tensor& 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) { diff --git a/faiss/gpu/impl/CuvsIVFPQ.cu b/faiss/gpu/impl/CuvsIVFPQ.cu index 2fc94de0f0..1e2fef225d 100644 --- a/faiss/gpu/impl/CuvsIVFPQ.cu +++ b/faiss/gpu/impl/CuvsIVFPQ.cu @@ -229,6 +229,8 @@ void CuvsIVFPQ::searchPreassigned( Tensor& 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) {