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

KNN bruteforce and IVF methods C/C++ API #33

Merged
merged 30 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
20658f8
Adding IVF-Flat and IVF-PQ
viclafargue Feb 7, 2024
6976acc
Adding bruteforce KNN
viclafargue Feb 7, 2024
9baadc8
Expose IVF methods
viclafargue Feb 7, 2024
9944bae
Adding bruteforce test
viclafargue Feb 9, 2024
b4fdee0
IVF-Flat and IVF-PQ tests
viclafargue Feb 16, 2024
85e0fba
Update IVF-Flat test
viclafargue Feb 19, 2024
1bae6b9
Update bruteforce KNN API
viclafargue Mar 1, 2024
2619b13
Update IVF-PQ testing
viclafargue Mar 1, 2024
540be0d
IVF-FLAT C API
viclafargue Mar 4, 2024
fe60dcc
Merge branch 'branch-24.04' into add-ivf_flat-and-ivf_pq
cjnolet Mar 4, 2024
e38d530
IVF-PQ C API
viclafargue Mar 4, 2024
089f67b
Merge branch 'branch-24.04' into add-ivf_flat-and-ivf_pq
cjnolet Mar 4, 2024
493165e
BRUTEFORCE C API
viclafargue Mar 5, 2024
33ffa18
REVERT cmake-format changes
viclafargue Mar 5, 2024
8738810
Fixing style/doc/comments issues
viclafargue Mar 8, 2024
1e1eb58
Solidify bruteforce index
viclafargue Mar 18, 2024
3e81649
IVF-FLAT compiled index
viclafargue Mar 18, 2024
0ac4820
IVF-PQ compiled index
viclafargue Mar 18, 2024
58dc152
Removing macros from headers
viclafargue Mar 18, 2024
f5aeffc
Merge remote-tracking branch 'rapidsai/branch-24.04' into add-ivf_fla…
viclafargue Mar 18, 2024
6aff838
IVF-Flat documentation
viclafargue Mar 18, 2024
5359afb
IVF-PQ documentation
viclafargue Mar 19, 2024
ab35e10
Bruteforce documentation
viclafargue Mar 19, 2024
675bf2a
C doc update
viclafargue Mar 19, 2024
00f67c2
C++ IVF-Flat doc examples
viclafargue Mar 19, 2024
ef5e3a4
C++ IVF-Flat and IVF-PQ doc examples
viclafargue Mar 19, 2024
53f6265
C++ Bruteforce doc examples
viclafargue Mar 19, 2024
82c003a
Add documentation for distance types
viclafargue Mar 19, 2024
d84d3cc
Python code generators
viclafargue Mar 19, 2024
7111bfb
Restore CMakeLists.txt style
viclafargue Mar 20, 2024
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
26 changes: 26 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,8 @@ include(cmake/thirdparty/get_cutlass.cmake)

add_library(
cuvs SHARED
src/neighbors/brute_force.cpp

src/neighbors/cagra_build_float.cpp
src/neighbors/cagra_build_int8.cpp
src/neighbors/cagra_build_uint8.cpp
Expand All @@ -198,6 +200,30 @@ add_library(
src/neighbors/cagra_serialize_float.cpp
src/neighbors/cagra_serialize_int8.cpp
src/neighbors/cagra_serialize_uint8.cpp

src/neighbors/ivf_flat_build_float.cpp
src/neighbors/ivf_flat_build_int8.cpp
src/neighbors/ivf_flat_build_uint8.cpp
src/neighbors/ivf_flat_extend_float.cpp
src/neighbors/ivf_flat_extend_int8.cpp
src/neighbors/ivf_flat_extend_uint8.cpp
src/neighbors/ivf_flat_search_float.cpp
src/neighbors/ivf_flat_search_int8.cpp
src/neighbors/ivf_flat_search_uint8.cpp
src/neighbors/ivf_flat_serialize_float.cpp
src/neighbors/ivf_flat_serialize_int8.cpp
src/neighbors/ivf_flat_serialize_uint8.cpp

src/neighbors/ivf_pq_build_float.cpp
src/neighbors/ivf_pq_build_int8.cpp
src/neighbors/ivf_pq_build_uint8.cpp
src/neighbors/ivf_pq_extend_float.cpp
src/neighbors/ivf_pq_extend_int8.cpp
src/neighbors/ivf_pq_extend_uint8.cpp
src/neighbors/ivf_pq_search_float.cpp
src/neighbors/ivf_pq_search_int8.cpp
src/neighbors/ivf_pq_search_uint8.cpp
src/neighbors/ivf_pq_serialize.cpp
)

target_compile_options(
Expand Down
39 changes: 39 additions & 0 deletions cpp/include/cuvs/neighbors/brute_force.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2024, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#pragma once

#include <raft/distance/distance_types.hpp>
#include <raft_runtime/neighbors/brute_force.hpp>


namespace cuvs::neighbors::brute_force {

#define RAFT_INST_BFKNN(IDX_T, DATA_T, MATRIX_IDX_T, INDEX_LAYOUT, SEARCH_LAYOUT) \
viclafargue marked this conversation as resolved.
Show resolved Hide resolved
void knn(raft::resources const& handle, \
viclafargue marked this conversation as resolved.
Show resolved Hide resolved
raft::device_matrix_view<const DATA_T, MATRIX_IDX_T, INDEX_LAYOUT> index, \
raft::device_matrix_view<const DATA_T, MATRIX_IDX_T, SEARCH_LAYOUT> search, \
raft::device_matrix_view<IDX_T, MATRIX_IDX_T, raft::row_major> indices, \
raft::device_matrix_view<DATA_T, MATRIX_IDX_T, raft::row_major> distances, \
raft::distance::DistanceType metric = raft::distance::DistanceType::L2Unexpanded, \
viclafargue marked this conversation as resolved.
Show resolved Hide resolved
std::optional<float> metric_arg = std::make_optional<float>(2.0f), \
std::optional<IDX_T> global_id_offset = std::nullopt);

RAFT_INST_BFKNN(int64_t, float, int64_t, raft::row_major, raft::row_major);

#undef RAFT_INST_BFKNN

} // namespace cuvs::neighbors::brute_force
Loading
Loading