From 7bf714928c501fceb19c0b4d0f2f33ccbf3fe153 Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Mon, 31 Jul 2023 07:37:27 -0700 Subject: [PATCH] Adding `libraft` dependency to speed up compile times with `USE_RAFT` (#2958) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/2958 Reviewed By: mlomeli1, mdouze Differential Revision: D47678341 Pulled By: algoriddle fbshipit-source-id: 2ab2d0e8349498faa0fc59ac9800da29a201c766 --- cmake/thirdparty/get_raft.cmake | 3 ++- faiss/gpu/CMakeLists.txt | 4 ++-- faiss/gpu/test/CMakeLists.txt | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cmake/thirdparty/get_raft.cmake b/cmake/thirdparty/get_raft.cmake index df5aa448e4..68c7299533 100644 --- a/cmake/thirdparty/get_raft.cmake +++ b/cmake/thirdparty/get_raft.cmake @@ -32,13 +32,14 @@ function(find_and_configure_raft) GLOBAL_TARGETS raft::raft BUILD_EXPORT_SET faiss-exports INSTALL_EXPORT_SET faiss-exports + COMPONENTS compiled CPM_ARGS GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git GIT_TAG ${PKG_PINNED_TAG} SOURCE_SUBDIR cpp OPTIONS "BUILD_TESTS OFF" - "RAFT_COMPILE_LIBRARY OFF" + "RAFT_COMPILE_LIBRARY ON" ) endfunction() diff --git a/faiss/gpu/CMakeLists.txt b/faiss/gpu/CMakeLists.txt index 5dfa6fdf3c..eca3889698 100644 --- a/faiss/gpu/CMakeLists.txt +++ b/faiss/gpu/CMakeLists.txt @@ -260,7 +260,7 @@ foreach(header ${FAISS_GPU_HEADERS}) endforeach() find_package(CUDAToolkit REQUIRED) -target_link_libraries(faiss PRIVATE CUDA::cudart CUDA::cublas $<$:raft::raft> $<$:nvidia::cutlass::cutlass>) -target_link_libraries(faiss_avx2 PRIVATE CUDA::cudart CUDA::cublas $<$:raft::raft> $<$:nvidia::cutlass::cutlass>) +target_link_libraries(faiss PRIVATE CUDA::cudart CUDA::cublas $<$:raft::raft> $<$:raft::compiled> $<$:nvidia::cutlass::cutlass>) +target_link_libraries(faiss_avx2 PRIVATE CUDA::cudart CUDA::cublas $<$:raft::raft> $<$:raft::compiled> $<$:nvidia::cutlass::cutlass>) target_compile_options(faiss PRIVATE $<$:-Xfatbin=-compress-all --expt-extended-lambda --expt-relaxed-constexpr>) target_compile_options(faiss_avx2 PRIVATE $<$:-Xfatbin=-compress-all --expt-extended-lambda --expt-relaxed-constexpr>) diff --git a/faiss/gpu/test/CMakeLists.txt b/faiss/gpu/test/CMakeLists.txt index ed68a142e8..9300deead9 100644 --- a/faiss/gpu/test/CMakeLists.txt +++ b/faiss/gpu/test/CMakeLists.txt @@ -23,7 +23,7 @@ find_package(CUDAToolkit REQUIRED) include(GoogleTest) add_library(faiss_gpu_test_helper TestUtils.cpp) -target_link_libraries(faiss_gpu_test_helper PUBLIC faiss gtest CUDA::cudart $<$:raft::raft>) +target_link_libraries(faiss_gpu_test_helper PUBLIC faiss gtest CUDA::cudart $<$:raft::raft> $<$:raft::compiled>) macro(faiss_gpu_test file) get_filename_component(test_name ${file} NAME_WE)