mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Summary: Remove the dependency on `raft::compiled` and modify GPU implementations to use cuVS backend in place of RAFT. A deeper insight into the dependency: FAISS gets the ANN algorithm implementations such as IVF-Flat and IVF-PQ from cuVS. RAFT is meant to be a lightweight C++ header-only template library that cuVS relies on for the more fundamental / low-level utilities. Some examples of these are RAFT's device mdarray and mdspan objects; the RAFT resource object (`raft::resource`) that takes care of the stream ordering of device functions; linear algebra functions such as mapping, reduction, BLAS routines etc. A lot of the cuVS functions take the RAFT mdspan objects as arguments (for example `raft::device_matrix_view`). Therefore FAISS relies on both cuVS and RAFT. FAISS gets RAFT headers through cuVS and uses them to create the function arguments that can be consumed by cuVS. Note that we are not explicitly linking FAISS against `raft::raft` or `raft::compiled`. Only the required headers are included and compiled rather than compiling the whole RAFT shared library. This is the reason we still see mentions of `raft` in FAISS. Pull Request resolved: https://github.com/facebookresearch/faiss/pull/3549 Reviewed By: ramilbakhshyiev Differential Revision: D62041013 Pulled By: asadoughi fbshipit-source-id: 7230dcc06cf47baf95873adc1dec2adca4a8f82a
27 lines
851 B
CMake
27 lines
851 B
CMake
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
target_sources(faiss_c PRIVATE
|
|
DeviceUtils_c.cpp
|
|
GpuAutoTune_c.cpp
|
|
GpuClonerOptions_c.cpp
|
|
GpuIndex_c.cpp
|
|
GpuResources_c.cpp
|
|
StandardGpuResources_c.cpp
|
|
)
|
|
|
|
file(GLOB FAISS_C_API_GPU_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
|
|
faiss_install_headers("${FAISS_C_API_GPU_HEADERS}" c_api/gpu)
|
|
|
|
if (FAISS_ENABLE_ROCM)
|
|
target_link_libraries(faiss_c PUBLIC hip::host roc::hipblas)
|
|
else()
|
|
find_package(CUDAToolkit REQUIRED)
|
|
target_link_libraries(faiss_c PUBLIC CUDA::cudart CUDA::cublas $<$<BOOL:${FAISS_ENABLE_CUVS}>:cuvs::cuvs>)
|
|
endif()
|
|
|
|
add_executable(example_gpu_c EXCLUDE_FROM_ALL example_gpu_c.c)
|
|
target_link_libraries(example_gpu_c PRIVATE faiss_c)
|