From f3b7151037d8079fafc73fd9884ddb8e0228a9dc Mon Sep 17 00:00:00 2001 From: "Corey J. Nolet" Date: Tue, 18 Jul 2023 13:55:52 -0400 Subject: [PATCH] Allowing FAISS to use libraft linked library to speed up compile times. --- 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 cfe4e0b195..9002f9eefc 100644 --- a/faiss/gpu/CMakeLists.txt +++ b/faiss/gpu/CMakeLists.txt @@ -200,7 +200,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)