Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Add pylibraft
Browse files Browse the repository at this point in the history
Signed-off-by: Mickael Ide <[email protected]>
  • Loading branch information
lowener committed Apr 14, 2023
1 parent 7a67021 commit 439aee2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ knowhere_option(WITH_BENCHMARK "Build with benchmark" OFF)
knowhere_option(WITH_COVERAGE "Build with coverage" OFF)
knowhere_option(WITH_CCACHE "Build with ccache" ON)
knowhere_option(WITH_PROFILER "Build with profiler" OFF)
knowhere_option(HINT_LIBRAFT "Hint directory for libraft" "")

if(KNOWHERE_VERSION)
message(STATUS "Building KNOWHERE version: ${KNOWHERE_VERSION}")
Expand Down Expand Up @@ -147,6 +148,14 @@ add_library(knowhere SHARED ${KNOWHERE_SRCS})
add_dependencies(knowhere ${KNOWHERE_LINKER_LIBS})
if(WITH_RAFT)
list(APPEND KNOWHERE_LINKER_LIBS raft::raft raft::compiled)
find_library(LIBRAFT_FOUND raft HINTS ${HINT_LIBRAFT})
if (NOT LIBRAFT_FOUND)
message(WARNING "libraft not found")
else()
message(STATUS "libraft found")
list(APPEND KNOWHERE_LINKER_LIBS ${LIBRAFT_FOUND})
add_definitions(-DRAFT_COMPILED)
endif()
endif()
target_link_libraries(knowhere PUBLIC ${KNOWHERE_LINKER_LIBS})
target_include_directories(
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Here's a list of verified OS types where Knowhere can successfully build and run

```bash
$ sudo apt install build-essential libopenblas-dev libaio-dev python3-dev python3-pip
$ pip3 install conan==1.59.0 --user
$ pip3 install conan==1.59.0 pylibraft-cu11 --user --extra-index=https://pypi.nvidia.com
$ export PATH=$PATH:$HOME/.local/bin
```

Expand All @@ -48,7 +48,7 @@ $ conan install .. --build=missing -o with_ut=True -o with_raft=True -s compiler
#DISKANN SUPPORT
$ conan install .. --build=missing -o with_ut=True -o with_diskann=True -s compiler.libcxx=libstdc++11 -s build_type=Debug/Release
#build with conan
$conan build ..
$ conan build ..
#verbose
export VERBOSE=1
```
Expand Down
6 changes: 6 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@ def generate(self):
if cxx_std_flag
else "c++{}".format(self._minimum_cpp_standard)
)
if self.options.with_raft:
try:
import pylibraft
tc.variables["HINT_LIBRAFT"] = pylibraft.__path__[0]
except:
pass
tc.variables["CXX_STD"] = cxx_std_value
if is_msvc(self):
tc.variables["MSVC_LANGUAGE_VERSION"] = cxx_std_value
Expand Down

0 comments on commit 439aee2

Please sign in to comment.