Skip to content

Commit 7bf7149

Browse files
cjnoletfacebook-github-bot
authored andcommitted
Adding libraft dependency to speed up compile times with USE_RAFT (facebookresearch#2958)
Summary: Pull Request resolved: facebookresearch#2958 Reviewed By: mlomeli1, mdouze Differential Revision: D47678341 Pulled By: algoriddle fbshipit-source-id: 2ab2d0e8349498faa0fc59ac9800da29a201c766
1 parent 726143d commit 7bf7149

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

cmake/thirdparty/get_raft.cmake

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@ function(find_and_configure_raft)
3232
GLOBAL_TARGETS raft::raft
3333
BUILD_EXPORT_SET faiss-exports
3434
INSTALL_EXPORT_SET faiss-exports
35+
COMPONENTS compiled
3536
CPM_ARGS
3637
GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git
3738
GIT_TAG ${PKG_PINNED_TAG}
3839
SOURCE_SUBDIR cpp
3940
OPTIONS
4041
"BUILD_TESTS OFF"
41-
"RAFT_COMPILE_LIBRARY OFF"
42+
"RAFT_COMPILE_LIBRARY ON"
4243
)
4344
endfunction()
4445

faiss/gpu/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ foreach(header ${FAISS_GPU_HEADERS})
260260
endforeach()
261261

262262
find_package(CUDAToolkit REQUIRED)
263-
target_link_libraries(faiss PRIVATE CUDA::cudart CUDA::cublas $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft> $<$<BOOL:${FAISS_ENABLE_RAFT}>:nvidia::cutlass::cutlass>)
264-
target_link_libraries(faiss_avx2 PRIVATE CUDA::cudart CUDA::cublas $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft> $<$<BOOL:${FAISS_ENABLE_RAFT}>:nvidia::cutlass::cutlass>)
263+
target_link_libraries(faiss PRIVATE CUDA::cudart CUDA::cublas $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft> $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::compiled> $<$<BOOL:${FAISS_ENABLE_RAFT}>:nvidia::cutlass::cutlass>)
264+
target_link_libraries(faiss_avx2 PRIVATE CUDA::cudart CUDA::cublas $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft> $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::compiled> $<$<BOOL:${FAISS_ENABLE_RAFT}>:nvidia::cutlass::cutlass>)
265265
target_compile_options(faiss PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-Xfatbin=-compress-all --expt-extended-lambda --expt-relaxed-constexpr>)
266266
target_compile_options(faiss_avx2 PRIVATE $<$<COMPILE_LANGUAGE:CUDA>:-Xfatbin=-compress-all --expt-extended-lambda --expt-relaxed-constexpr>)

faiss/gpu/test/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ find_package(CUDAToolkit REQUIRED)
2323
include(GoogleTest)
2424

2525
add_library(faiss_gpu_test_helper TestUtils.cpp)
26-
target_link_libraries(faiss_gpu_test_helper PUBLIC faiss gtest CUDA::cudart $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft>)
26+
target_link_libraries(faiss_gpu_test_helper PUBLIC faiss gtest CUDA::cudart $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::raft> $<$<BOOL:${FAISS_ENABLE_RAFT}>:raft::compiled>)
2727

2828
macro(faiss_gpu_test file)
2929
get_filename_component(test_name ${file} NAME_WE)

0 commit comments

Comments
 (0)