Skip to content

Commit

Permalink
add patch to separate build of libfaiss_avx2 from libfaiss
Browse files Browse the repository at this point in the history
  • Loading branch information
h-vetinari committed Jun 2, 2021
1 parent 2f7e0b3 commit 05bb9bd
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 2 deletions.
2 changes: 2 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ source:
- patches/0001-use-c-14.patch # [win and cuda_compiler_version != "10.2"]
# patch for avoiding crash in GPU test suite on windows
- patches/0002-skip-test_stress-for-GPU-on-windows.patch
# enable building libfaiss_avx2 without libfaiss
- patches/0003-enable-building-libfaiss_avx2-without-libfaiss.patch

build:
number: 0
Expand Down
2 changes: 1 addition & 1 deletion recipe/patches/0001-use-c-14.patch
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From a2e1ffdca0490b4e377c9aebb5ab5b554669c5fb Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Mon, 26 Oct 2020 22:44:44 +0100
Subject: [PATCH 1/2] use c++14
Subject: [PATCH 1/3] use c++14

---
CMakeLists.txt | 2 +-
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From baa69fd2dec67313670eb271dff4717e25bd51f7 Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Fri, 19 Feb 2021 14:14:31 +0100
Subject: [PATCH 2/2] skip test_stress for GPU on windows
Subject: [PATCH 2/3] skip test_stress for GPU on windows

---
faiss/gpu/test/test_gpu_basics.py | 2 ++
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
From c6396047a9f44ee4349bea3da1e903b9019d3d1a Mon Sep 17 00:00:00 2001
From: "H. Vetinari" <h.vetinari@gmx.com>
Date: Wed, 2 Jun 2021 22:58:19 +0200
Subject: [PATCH 3/3] enable building libfaiss_avx2 without libfaiss

---
faiss/CMakeLists.txt | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/faiss/CMakeLists.txt b/faiss/CMakeLists.txt
index 30d573f0..4231ae9b 100644
--- a/faiss/CMakeLists.txt
+++ b/faiss/CMakeLists.txt
@@ -225,18 +225,21 @@ else()
target_link_libraries(faiss_avx2 PRIVATE ${LAPACK_LIBRARIES})
endif()

-install(TARGETS faiss
- EXPORT faiss-targets
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
- INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-)
-if(FAISS_OPT_LEVEL STREQUAL "avx2")
+if(NOT FAISS_OPT_LEVEL STREQUAL "avx2")
+ install(TARGETS faiss
+ EXPORT faiss-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+ )
+else()
install(TARGETS faiss_avx2
EXPORT faiss-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
)
endif()

--
2.31.1.windows.1

0 comments on commit 05bb9bd

Please sign in to comment.