Skip to content

Commit

Permalink
Upgrade CUVS to 24.12 (#4021)
Browse files Browse the repository at this point in the history
Summary: Pull Request resolved: #4021

Reviewed By: mnorris11

Differential Revision: D67482128

Pulled By: asadoughi

fbshipit-source-id: 47a2b870d8be85580ddf82a40b625b4eee4b072e
  • Loading branch information
tarang-jain authored and facebook-github-bot committed Dec 20, 2024
1 parent 0a0af00 commit 5637bb8
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 38 deletions.
5 changes: 2 additions & 3 deletions .github/actions/build_cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,14 @@ runs:
conda install -y -q cuda-toolkit=12.4 -c "nvidia/label/cuda-12.4.0"
# and CUDA from cuVS channel for cuVS builds
elif [ "${{ inputs.cuvs }}" = "ON" ]; then
conda install -y -q libcuvs=24.08 cuda-version=12.4 cuda-toolkit=12.4.1 gxx_linux-64=12.4 -c rapidsai -c conda-forge -c "nvidia/label/cuda-12.4.0"
conda install -y -q libcuvs=24.12 'cuda-version>=12.0,<=12.5' cuda-toolkit=12.4.1 gxx_linux-64=12.4 -c rapidsai -c conda-forge
fi
# install test packages
if [ "${{ inputs.rocm }}" = "ON" ]; then
: # skip torch install via conda, we need to install via pip to get
# ROCm-enabled version until it's supported in conda by PyTorch
elif [ "${{ inputs.gpu }}" = "ON" ]; then
conda install -y -q "pytorch<2.5" pytorch-cuda=12.4 -c pytorch -c nvidia/label/cuda-12.4.0
conda install -y -q "pytorch<2.5" pytorch-cuda=12.4 -c pytorch -c "nvidia/label/cuda-12.4.0"
else
conda install -y -q "pytorch<2.5" -c pytorch
fi
Expand Down
4 changes: 2 additions & 2 deletions .github/actions/build_conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ runs:
working-directory: conda
run: |
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
-c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge
-c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge -c nvidia
- name: Conda build (GPU w/ cuVS) w/ anaconda upload
if: inputs.label != '' && inputs.cuda != '' && inputs.cuvs != ''
shell: ${{ steps.choose_shell.outputs.shell }}
Expand All @@ -93,4 +93,4 @@ runs:
PACKAGE_TYPE: ${{ inputs.label }}
run: |
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
--user pytorch --label ${{ inputs.label }} -c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge
--user pytorch --label ${{ inputs.label }} -c pytorch -c rapidsai -c rapidsai-nightly -c conda-forge -c nvidia
30 changes: 30 additions & 0 deletions .github/workflows/build-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,36 @@ 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
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# LICENSE file in the root directory of this source tree.

# =============================================================================
# Copyright (c) 2023, NVIDIA CORPORATION.
# Copyright (c) 2023-2024, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
# in compliance with the License. You may obtain a copy of the License at
Expand Down
2 changes: 1 addition & 1 deletion cmake/thirdparty/fetch_rapids.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# or implied. See the License for the specific language governing permissions and limitations under
# the License.
# =============================================================================
set(RAPIDS_VERSION "24.08")
set(RAPIDS_VERSION "24.12")

if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FAISS_RAPIDS.cmake)
file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION}/RAPIDS.cmake
Expand Down
18 changes: 9 additions & 9 deletions conda/faiss-gpu-cuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
{% set suffix = "_nightly" if environ.get('PACKAGE_TYPE') == 'nightly' else "" %}
{% set number = GIT_DESCRIBE_NUMBER %}
{% if cudatoolkit == '11.8.0' %}
{% set cuda_constraints=">=11.8,<12" %}
{% set libcublas_constraints=">=11.11,<12" %}
{% set cuda_constraints=">=11.4,<12" %}
{% set libcublas_constraints=">=11.6,<12" %}
{% elif cudatoolkit == '12.4.0' %}
{% set cuda_constraints=">=12.1,<13" %}
{% set cuda_constraints=">=12.1,<12.5" %}
{% set libcublas_constraints=">=12.1,<13" %}
{% endif %}

Expand Down Expand Up @@ -45,7 +45,7 @@ outputs:
- CUDA_ARCHS
requirements:
build:
- {{ compiler('cxx') }}
- {{ compiler('cxx') }} =12.4
- sysroot_linux-64 =2.17 # [linux64]
- llvm-openmp # [osx]
- cmake >=3.26.4
Expand All @@ -58,15 +58,15 @@ outputs:
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- mkl =2023 # [x86_64]
- openblas =0.3 # [not x86_64]
- libcuvs =24.08
- cuda-version {{ cudatoolkit }}
- libcuvs =24.12
- cuda-version {{ cuda_constraints }}
run:
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- mkl =2023 # [x86_64]
- openblas =0.3 # [not x86_64]
- cuda-cudart {{ cuda_constraints }}
- libcublas {{ libcublas_constraints }}
- libcuvs =24.08
- libcuvs =24.12
- cuda-version {{ cuda_constraints }}
test:
requires:
Expand All @@ -86,10 +86,10 @@ outputs:
string: "py{{ PY_VER }}_h{{ PKG_HASH }}_{{ number }}_cuda{{ cudatoolkit }}{{ suffix }}"
requirements:
build:
- {{ compiler('cxx') }}
- {{ compiler('cxx') }} =12.4
- sysroot_linux-64 =2.17 # [linux64]
- swig =4.0
- cmake >=3.24.0
- cmake >=3.26.4
- make =4.2 # [not win]
- _openmp_mutex =4.5=2_kmp_llvm # [x86_64]
- mkl =2023 # [x86_64]
Expand Down
16 changes: 3 additions & 13 deletions faiss/gpu/GpuDistance.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -320,12 +320,7 @@ void bfKnn(GpuResourcesProvider* prov, const GpuDistanceParams& args) {
cuvs::neighbors::brute_force::index<float> idx(
handle, index.view(), norms_view, distance, metric_arg);
cuvs::neighbors::brute_force::search(
handle,
idx,
search.view(),
inds.view(),
dists.view(),
std::nullopt);
handle, idx, search.view(), inds.view(), dists.view());
} else {
auto index = raft::make_readonly_temporary_device_buffer<
const float,
Expand Down Expand Up @@ -364,12 +359,7 @@ void bfKnn(GpuResourcesProvider* prov, const GpuDistanceParams& args) {
cuvs::neighbors::brute_force::index<float> idx(
handle, index.view(), norms_view, distance, metric_arg);
cuvs::neighbors::brute_force::search(
handle,
idx,
search.view(),
inds.view(),
dists.view(),
std::nullopt);
handle, idx, search.view(), inds.view(), dists.view());
}

if (args.metric == MetricType::METRIC_Lp) {
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/GpuIndex.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/GpuResources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/GpuResources.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 1 addition & 2 deletions faiss/gpu/impl/CuvsFlatIndex.cu
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ void CuvsFlatIndex::query(

cuvs::neighbors::brute_force::index idx(
handle, index, norms_view, distance, metricArg);
cuvs::neighbors::brute_force::search(
handle, idx, search, inds, dists, std::nullopt);
cuvs::neighbors::brute_force::search(handle, idx, search, inds, dists);

if (metric == MetricType::METRIC_Lp) {
raft::linalg::unary_op(
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/test/TestGpuDistance.cu
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion faiss/gpu/test/TestGpuIndexIVFFlat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* LICENSE file in the root directory of this source tree.
*/
/*
* Copyright (c) 2023, NVIDIA CORPORATION.
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion faiss/gpu/test/test_gpu_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,6 @@ def test_indices_ivfpq(self):
xb_indices = (xb_indices_base + 4294967296).astype('int64')

config = faiss.GpuIndexIVFPQConfig()
config.use_cuvs = False
idx = faiss.GpuIndexIVFPQ(res, d, nlist, M, nbits,
faiss.METRIC_L2, config)
idx.train(xb)
Expand All @@ -450,6 +449,8 @@ def test_indices_ivfpq(self):

# Store values using 32-bit indices instead
config.indicesOptions = faiss.INDICES_32_BIT
# 32-bit indices are not supported with cuVS
config.use_cuvs = False
idx = faiss.GpuIndexIVFPQ(res, d, nlist, M, nbits,
faiss.METRIC_L2, config)
idx.train(xb)
Expand Down
1 change: 0 additions & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ find_package(GTest CONFIG REQUIRED)
target_link_libraries(faiss_test PRIVATE
OpenMP::OpenMP_CXX
GTest::gtest_main
$<$<BOOL:${FAISS_ENABLE_CUVS}>:cuvs::cuvs>
$<$<BOOL:${FAISS_ENABLE_ROCM}>:hip::host>
)

Expand Down

0 comments on commit 5637bb8

Please sign in to comment.