Skip to content

Commit

Permalink
fix: moving back to FAISS master
Browse files Browse the repository at this point in the history
  • Loading branch information
beniz authored and mergify[bot] committed May 17, 2021
1 parent 0163b02 commit 916338b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
20 changes: 8 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ if (NOT CUDA_FOUND)
endif()

# annoy
if (USE_CAFFE)
if (USE_CAFFE OR USE_TORCH)
if (USE_SIMSEARCH)
if (USE_FAISS AND USE_ANNOY)
message (STATUS "ANNOY selected, using ANNOY as simsearch backend")
Expand Down Expand Up @@ -320,14 +320,9 @@ if (USE_CAFFE)
endif()
if(USE_FAISS)
if (USE_FAISS_CPU_ONLY)
set(CONFIGURE_OPTS "--without-cuda")
set(CONFIGURE_OPTS "-DFAISS_ENABLE_GPU=OFF")
else()
string(REPLACE "/include" "" CUDA_PREFIX ${CUDA_INCLUDE_DIRS})
if (NOT CUDA_ARCH)
string(REPLACE ";" " " CUDA_ARCH "${CUDA_NVCC_FLAGS}")
endif()
set(CONFIGURE_OPTS --with-cuda=${CUDA_PREFIX} --with-cuda-arch=${CUDA_ARCH})
add_definitions(-DUSE_GPU_FAISS)
set(CONFIGURE_OPTS "-DCMAKE_CUDA_COMPILER=/usr/local/cuda/bin/nvcc")
endif()
message(STATUS "Fetching FAISS")
add_definitions(-DUSE_FAISS)
Expand All @@ -336,15 +331,16 @@ if (USE_CAFFE)
faisslib
PREFIX faiss
SOURCE_DIR ${CMAKE_BINARY_DIR}/faiss/src/faiss
GIT_REPOSITORY https://github.com/jolibrain/faiss
CONFIGURE_COMMAND ./configure ${CONFIGURE_OPTS}
GIT_REPOSITORY https://github.com/facebookresearch/faiss
CONFIGURE_COMMAND cmake ${CONFIGURE_OPTS} -B build .
BUILD_COMMAND make -C build -j${N}
INSTALL_COMMAND ""
BUILD_IN_SOURCE 1
)

set(FAISS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/faiss/src/)
set(FAISS_INCLUDE_DIR ${CMAKE_BINARY_DIR}/faiss/src/faiss)
include_directories("${FAISS_INCLUDE_DIR}")
set(FAISS_LIB_DIR ${CMAKE_BINARY_DIR}/faiss/src/faiss)
set(FAISS_LIB_DIR ${CMAKE_BINARY_DIR}/faiss/src/faiss/build/faiss)
set(FAISS_LIB_DEPS faiss)
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion src/simsearch.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "utils/utils.hpp"
#ifdef USE_FAISS
#include "faiss/IndexIVF.h"
#include "faiss/OnDiskInvertedLists.h"
#include "faiss/invlists/OnDiskInvertedLists.h"
#include "faiss/IndexPreTransform.h"
#include "faiss/index_factory.h"
#ifdef USE_GPU_FAISS
Expand Down

0 comments on commit 916338b

Please sign in to comment.