Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building faiss main statically #2323

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Enable arm builds
  • Loading branch information
robertmaynard committed May 20, 2024
commit 59f02f64678aed58fad53dbab39479aa47b0cf9f
7 changes: 0 additions & 7 deletions cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,6 @@ set(RAFT_ANN_BENCH_USE_FAISS ON)
set(RAFT_FAISS_ENABLE_GPU ON)
set(RAFT_USE_FAISS_STATIC ON)

# Faiss doesn't support ARM currently
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(RAFT_ANN_BENCH_USE_FAISS OFF)
set(RAFT_FAISS_ENABLE_GPU OFF)
set(RAFT_USE_FAISS_STATIC OFF)
endif()

if(BUILD_CPU_ONLY)

# Include necessary logging dependencies
Expand Down
10 changes: 8 additions & 2 deletions cpp/cmake/thirdparty/get_faiss.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,17 @@ function(find_and_configure_faiss)

# Need to tell CMake to rescan the link group of faiss::faiss_gpu and faiss
# so that we get proper link order when they are static
if(PKG_ENABLE_GPU AND PKG_BUILD_STATIC_LIBS AND TARGET faiss::faiss_avx2)
#
# We don't look at the existence of `faiss_avx2` as it will always exist
# even when CXX_AVX2_FOUND is false. In addition for arm builds the
# faiss_avx2 is marked as `EXCLUDE_FROM_ALL` so we don't want to add
# a dependency to it. Adding a dependency will cause it to compile,
# and fail due to invalid compiler flags.
if(PKG_ENABLE_GPU AND PKG_BUILD_STATIC_LIBS AND CXX_AVX2_FOUND)
set(RAFT_FAISS_TARGETS "$<LINK_GROUP:RESCAN,$<LINK_LIBRARY:WHOLE_ARCHIVE,faiss_gpu>,faiss::faiss_avx2>" PARENT_SCOPE)
elseif(PKG_ENABLE_GPU AND PKG_BUILD_STATIC_LIBS)
set(RAFT_FAISS_TARGETS "$<LINK_GROUP:RESCAN,$<LINK_LIBRARY:WHOLE_ARCHIVE,faiss_gpu>,faiss::faiss_avx>" PARENT_SCOPE)
elseif(TARGET faiss::faiss_avx2)
elseif(CXX_AVX2_FOUND)
set(RAFT_FAISS_TARGETS faiss::faiss_avx2 PARENT_SCOPE)
else()
set(RAFT_FAISS_TARGETS faiss::faiss PARENT_SCOPE)
Expand Down