-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
860 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
cpp/src/neighbors/ivf_flat/ivf_flat_build_extend_half_int64_t.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by generate_ivf_flat.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python generate_ivf_flat.py | ||
* | ||
*/ | ||
|
||
#include <cuvs/neighbors/ivf_flat.hpp> | ||
|
||
#include "ivf_flat_build.cuh" | ||
|
||
namespace cuvs::neighbors::ivf_flat { | ||
|
||
#define CUVS_INST_IVF_FLAT_BUILD_EXTEND(T, IdxT) \ | ||
auto build(raft::resources const& handle, \ | ||
const cuvs::neighbors::ivf_flat::index_params& params, \ | ||
raft::device_matrix_view<const T, IdxT, raft::row_major> dataset) \ | ||
->cuvs::neighbors::ivf_flat::index<T, IdxT> \ | ||
{ \ | ||
return cuvs::neighbors::ivf_flat::index<T, IdxT>( \ | ||
std::move(cuvs::neighbors::ivf_flat::detail::build(handle, params, dataset))); \ | ||
} \ | ||
\ | ||
void build(raft::resources const& handle, \ | ||
const cuvs::neighbors::ivf_flat::index_params& params, \ | ||
raft::device_matrix_view<const T, IdxT, raft::row_major> dataset, \ | ||
cuvs::neighbors::ivf_flat::index<T, IdxT>& idx) \ | ||
{ \ | ||
cuvs::neighbors::ivf_flat::detail::build(handle, params, dataset, idx); \ | ||
} \ | ||
auto build(raft::resources const& handle, \ | ||
const cuvs::neighbors::ivf_flat::index_params& params, \ | ||
raft::host_matrix_view<const T, IdxT, raft::row_major> dataset) \ | ||
->cuvs::neighbors::ivf_flat::index<T, IdxT> \ | ||
{ \ | ||
return cuvs::neighbors::ivf_flat::index<T, IdxT>( \ | ||
std::move(cuvs::neighbors::ivf_flat::detail::build(handle, params, dataset))); \ | ||
} \ | ||
\ | ||
void build(raft::resources const& handle, \ | ||
const cuvs::neighbors::ivf_flat::index_params& params, \ | ||
raft::host_matrix_view<const T, IdxT, raft::row_major> dataset, \ | ||
cuvs::neighbors::ivf_flat::index<T, IdxT>& idx) \ | ||
{ \ | ||
cuvs::neighbors::ivf_flat::detail::build(handle, params, dataset, idx); \ | ||
} \ | ||
auto extend(raft::resources const& handle, \ | ||
raft::device_matrix_view<const T, IdxT, raft::row_major> new_vectors, \ | ||
std::optional<raft::device_vector_view<const IdxT, IdxT>> new_indices, \ | ||
const cuvs::neighbors::ivf_flat::index<T, IdxT>& orig_index) \ | ||
->cuvs::neighbors::ivf_flat::index<T, IdxT> \ | ||
{ \ | ||
return cuvs::neighbors::ivf_flat::index<T, IdxT>(std::move( \ | ||
cuvs::neighbors::ivf_flat::detail::extend(handle, new_vectors, new_indices, orig_index))); \ | ||
} \ | ||
\ | ||
void extend(raft::resources const& handle, \ | ||
raft::device_matrix_view<const T, IdxT, raft::row_major> new_vectors, \ | ||
std::optional<raft::device_vector_view<const IdxT, IdxT>> new_indices, \ | ||
cuvs::neighbors::ivf_flat::index<T, IdxT>* idx) \ | ||
{ \ | ||
cuvs::neighbors::ivf_flat::detail::extend(handle, new_vectors, new_indices, idx); \ | ||
} \ | ||
auto extend(raft::resources const& handle, \ | ||
raft::host_matrix_view<const T, IdxT, raft::row_major> new_vectors, \ | ||
std::optional<raft::host_vector_view<const IdxT, IdxT>> new_indices, \ | ||
const cuvs::neighbors::ivf_flat::index<T, IdxT>& orig_index) \ | ||
->cuvs::neighbors::ivf_flat::index<T, IdxT> \ | ||
{ \ | ||
return cuvs::neighbors::ivf_flat::index<T, IdxT>(std::move( \ | ||
cuvs::neighbors::ivf_flat::detail::extend(handle, new_vectors, new_indices, orig_index))); \ | ||
} \ | ||
\ | ||
void extend(raft::resources const& handle, \ | ||
raft::host_matrix_view<const T, IdxT, raft::row_major> new_vectors, \ | ||
std::optional<raft::host_vector_view<const IdxT, IdxT>> new_indices, \ | ||
cuvs::neighbors::ivf_flat::index<T, IdxT>* idx) \ | ||
{ \ | ||
cuvs::neighbors::ivf_flat::detail::extend(handle, new_vectors, new_indices, idx); \ | ||
} | ||
CUVS_INST_IVF_FLAT_BUILD_EXTEND(half, int64_t); | ||
|
||
#undef CUVS_INST_IVF_FLAT_BUILD_EXTEND | ||
|
||
} // namespace cuvs::neighbors::ivf_flat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
cpp/src/neighbors/ivf_flat/ivf_flat_search_half_int64_t.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by generate_ivf_flat.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python generate_ivf_flat.py | ||
* | ||
*/ | ||
|
||
#include <cuvs/neighbors/ivf_flat.hpp> | ||
|
||
#include "ivf_flat_search.cuh" | ||
|
||
namespace cuvs::neighbors::ivf_flat { | ||
|
||
#define CUVS_INST_IVF_FLAT_SEARCH(T, IdxT) \ | ||
void search(raft::resources const& handle, \ | ||
const cuvs::neighbors::ivf_flat::search_params& params, \ | ||
const cuvs::neighbors::ivf_flat::index<T, IdxT>& index, \ | ||
raft::device_matrix_view<const T, IdxT, raft::row_major> queries, \ | ||
raft::device_matrix_view<IdxT, IdxT, raft::row_major> neighbors, \ | ||
raft::device_matrix_view<float, IdxT, raft::row_major> distances, \ | ||
const cuvs::neighbors::filtering::base_filter& sample_filter) \ | ||
{ \ | ||
cuvs::neighbors::ivf_flat::detail::search( \ | ||
handle, params, index, queries, neighbors, distances, sample_filter); \ | ||
} | ||
CUVS_INST_IVF_FLAT_SEARCH(half, int64_t); | ||
|
||
#undef CUVS_INST_IVF_FLAT_SEARCH | ||
|
||
} // namespace cuvs::neighbors::ivf_flat |
35 changes: 35 additions & 0 deletions
35
cpp/src/neighbors/ivf_flat/ivf_flat_serialize_half_int64_t.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
/* | ||
* NOTE: this file is generated by generate_ivf_flat.py | ||
* | ||
* Make changes there and run in this directory: | ||
* | ||
* > python generate_ivf_flat.py | ||
* | ||
*/ | ||
|
||
#include <cuvs/neighbors/ivf_flat.hpp> | ||
|
||
#include "ivf_flat_serialize.cuh" | ||
|
||
namespace cuvs::neighbors::ivf_flat { | ||
CUVS_INST_IVF_FLAT_SERIALIZE(half, int64_t); | ||
|
||
#undef CUVS_INST_IVF_FLAT_SERIALIZE | ||
|
||
} // namespace cuvs::neighbors::ivf_flat |
Oops, something went wrong.