-
Notifications
You must be signed in to change notification settings - Fork 69
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
Diskann Benchmarking Wrapper #260
Open
tarang-jain
wants to merge
103
commits into
rapidsai:branch-25.02
Choose a base branch
from
tarang-jain:diskann-wrapper
base: branch-25.02
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 93 commits
Commits
Show all changes
103 commits
Select commit
Hold shift + click to select a range
8e8d3c1
initial commit
tarang-jain e937ebd
merge 24.08
tarang-jain 0bbbf0d
make build
tarang-jain 02084e2
Merge branch 'branch-24.08' of https://github.com/rapidsai/cuvs into …
tarang-jain 64f1d60
Merge branch 'branch-24.10' into diskann-wrapper
tarang-jain 706f22e
update wrapper
tarang-jain 3ea499b
Merge branch 'branch-24.08' of https://github.com/rapidsai/cuvs into …
tarang-jain e0aab8f
diskann_memory working
tarang-jain 17c5510
Merge branch 'branch-24.08' of https://github.com/rapidsai/cuvs into …
tarang-jain f426df9
Merge branch 'branch-24.10' of https://github.com/rapidsai/cuvs into …
tarang-jain a7bdd33
make compile
tarang-jain d2442ca
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
tarang-jain dbc84cc
rm num_threads_
tarang-jain 7e37218
FEA Add cuvs-bench to dependencies and conda environments
dantegd b2aef6d
FIX add missing deps
dantegd b9762d5
Merge branch 'fea-add-bench-deps' of https://github.com/dantegd/cuvs …
tarang-jain bf75242
FIX version and other improvements
dantegd a8bcdef
FEA Add cuvs_bench.run
dantegd 3818da9
update patch;build command
tarang-jain cd8bfe5
Merge branch 'cuvsbench-run' of https://github.com/dantegd/cuvs into …
tarang-jain ec6d70c
FIX some cuvs_bench python build dependencies
dantegd c9f797a
Merge branch 'cuvsbench-run' of https://github.com/dantegd/cuvs into …
tarang-jain 585ad53
FIX add missing algorithms.yaml
dantegd 441ab2a
Merge branch 'cuvsbench-run' of https://github.com/dantegd/cuvs into …
tarang-jain 33b075d
working mem index
tarang-jain 81c92e6
Merge branch 'branch-24.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 11545c3
Merge branch 'rapidsai:branch-24.10' into diskann-wrapper
tarang-jain ffea663
remove base_set warning
tarang-jain 9c1cddc
Merge branch 'branch-24.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 96d5642
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
tarang-jain a7eb787
pull upstream
tarang-jain 4cbe7b1
merge 24.10
tarang-jain 63621f4
revert some changes
tarang-jain a890ac5
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 450dcee
revert
tarang-jain b0f4b57
revert
tarang-jain 8cd6c40
revert
tarang-jain d658856
update dependencies
tarang-jain d1e4101
Merge branch 'branch-24.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 2e080c6
update diff
tarang-jain 8c6a178
Merge branch 'branch-24.10' of https://github.com/rapidsai/cuvs into …
tarang-jain 626dc17
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain 3d15882
style
tarang-jain a72165c
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 9c202f2
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
tarang-jain 58a729c
diskann_memory working
tarang-jain 2412b70
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 3a56402
ssd wrapper working, cuvs_vamana DOES NOT BUILD
tarang-jain 0b39d5b
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 92ec474
builds now
tarang-jain 333539f
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain a13bf1a
rm bug
tarang-jain df54939
add beam_width, rm dbg statements
tarang-jain 93b2620
style
tarang-jain 54385ab
updates after PR reviews, replace thread_pool with omp pragma
tarang-jain c35d899
codespell
tarang-jain 31d846a
sync stream in vamana serialize
tarang-jain 61e00c7
re-enable warnings
tarang-jain 0bf43e9
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 0a6b094
deps in conda recipe
tarang-jain 645d84b
host deps
tarang-jain d6897cc
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 396a589
Update conda/recipes/cuvs_bench/meta.yaml
tarang-jain d325698
Update conda/recipes/cuvs_bench_cpu/meta.yaml
tarang-jain 03a1e09
arch dependendent diskann deps
tarang-jain f061f27
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain f95aec7
arch specific deps
tarang-jain b667786
CMAKE_SYSTEM_PROCESSOR check
tarang-jain 4aa513f
update cmake flags
tarang-jain 17f723e
CMAKE_SYSTEM_PROCESSOR regex
tarang-jain 6532914
diskann build params
tarang-jain 1f168a8
dbg
tarang-jain 2a5d1fb
rename script to cuvs_vamana.cu
tarang-jain 173df8f
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain 46e7728
rm dbg statement
tarang-jain 1b03cf7
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
tarang-jain c131c52
do not link cuvs for diskann only targets
tarang-jain 3d40d2d
link aio
tarang-jain c3a25fc
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 6bebeb8
style
tarang-jain e254c9b
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain 82e21e8
Merge branch 'branch-24.12' into diskann-wrapper
cjnolet de2bf84
Merge branch 'branch-24.12' of https://github.com/rapidsai/cuvs into …
tarang-jain 6d3b32d
include utils.h
tarang-jain 2506ef1
serialize dataset
tarang-jain 16f35b3
debug
tarang-jain 18f26a7
rm debug statements
tarang-jain 663dfe0
style
tarang-jain 4bb2b39
alloc strided dim on host
tarang-jain fd43711
size
tarang-jain 30bcc6e
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
a10d834
include_dataset flag
4b396d7
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain c443944
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
ed8c9b6
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain f015264
rm cagra+diskann
6d6167d
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain 9c2185b
Merge branch 'branch-24.12' into diskann-wrapper
tarang-jain 2b758d3
Merge branch 'diskann-wrapper' of https://github.com/tarang-jain/cuvs…
tarang-jain b7ba35b
update copyright
tarang-jain 63e02ff
Merge branch 'branch-25.02' into diskann-wrapper
tarang-jain 48a6a9d
Merge branch 'branch-25.02' into diskann-wrapper
cjnolet fd429d2
style
tarang-jain File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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,108 @@ | ||
/* | ||
* Copyright (c) 2023-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 "../hnswlib/hnswlib_wrapper.h" | ||
#include "cuvs_cagra_wrapper.h" | ||
|
||
#include <memory> | ||
|
||
namespace cuvs::bench { | ||
|
||
template <typename T, typename IdxT> | ||
class cuvs_cagra_diskann : public algo<T>, public algo_gpu { | ||
public: | ||
using search_param_base = typename algo<T>::search_param; | ||
using build_param = typename cuvs_cagra<T, IdxT>::build_param; | ||
using search_param = typename diskann_mem<T>::search_param; | ||
|
||
cuvs_cagra_diskann(Metric metric, int dim, const build_param& param) | ||
: algo<T>(metric, dim), | ||
cagra_build_{metric, dim, param}, | ||
// hnsw_lib param values don't matter since we don't build with hnsw_lib | ||
diskann_mem_search_{metric, dim, typename diskann_mem<T>::build_param{50, 100}} | ||
{ | ||
} | ||
|
||
void build(const T* dataset, size_t nrow) final; | ||
|
||
void set_search_param(const search_param_base& param) override; | ||
|
||
void search(const T* queries, | ||
int batch_size, | ||
int k, | ||
algo_base::index_type* neighbors, | ||
float* distances) const override; | ||
|
||
[[nodiscard]] auto get_sync_stream() const noexcept -> cudaStream_t override | ||
{ | ||
return cagra_build_.get_sync_stream(); | ||
} | ||
|
||
// to enable dataset access from GPU memory | ||
[[nodiscard]] auto get_preference() const -> algo_property override | ||
{ | ||
algo_property property; | ||
property.dataset_memory_type = MemoryType::kHostMmap; | ||
property.query_memory_type = MemoryType::kHost; | ||
return property; | ||
} | ||
|
||
void save(const std::string& file) const override; | ||
void load(const std::string&) override; | ||
std::unique_ptr<algo<T>> copy() override | ||
{ | ||
return std::make_unique<cuvs_cagra_hnswlib<T, IdxT>>(*this); | ||
} | ||
|
||
private: | ||
cuvs_cagra<T, IdxT> cagra_build_; | ||
hnsw_lib<T> hnswlib_search_; | ||
}; | ||
|
||
template <typename T, typename IdxT> | ||
void cuvs_cagra_hnswlib<T, IdxT>::build(const T* dataset, size_t nrow) | ||
{ | ||
cagra_build_.build(dataset, nrow); | ||
} | ||
|
||
template <typename T, typename IdxT> | ||
void cuvs_cagra_hnswlib<T, IdxT>::set_search_param(const search_param_base& param_) | ||
{ | ||
hnswlib_search_.set_search_param(param_); | ||
} | ||
|
||
template <typename T, typename IdxT> | ||
void cuvs_cagra_hnswlib<T, IdxT>::save(const std::string& file) const | ||
tarang-jain marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
cagra_build_.save_to_hnswlib(file); | ||
} | ||
|
||
template <typename T, typename IdxT> | ||
void cuvs_cagra_hnswlib<T, IdxT>::load(const std::string& file) | ||
{ | ||
hnswlib_search_.load(file); | ||
hnswlib_search_.set_base_layer_only(); | ||
} | ||
|
||
template <typename T, typename IdxT> | ||
void cuvs_cagra_hnswlib<T, IdxT>::search( | ||
const T* queries, int batch_size, int k, algo_base::index_type* neighbors, float* distances) const | ||
{ | ||
hnswlib_search_.search(queries, batch_size, k, neighbors, distances); | ||
} | ||
|
||
} // namespace cuvs::bench |
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,93 @@ | ||
/* | ||
* Copyright (c) 2023-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. | ||
*/ | ||
|
||
#include "../common/ann_types.hpp" | ||
#include "cuvs_vamana_wrapper.h" | ||
|
||
#include <rmm/cuda_device.hpp> | ||
#include <rmm/mr/device/pool_memory_resource.hpp> | ||
#include <rmm/resource_ref.hpp> | ||
|
||
namespace cuvs::bench { | ||
|
||
template <typename T, typename IdxT> | ||
void parse_build_param(const nlohmann::json& conf, | ||
typename cuvs::bench::cuvs_vamana<T, IdxT>::build_param& param) | ||
{ | ||
if (conf.contains("graph_degree")) { param.graph_degree = conf.at("graph_degree"); } | ||
if (conf.contains("visited_size")) { param.visited_size = conf.at("visited_size"); } | ||
if (conf.contains("alpha")) { param.alpha = conf.at("alpha"); } | ||
} | ||
|
||
template <typename T, typename IdxT> | ||
void parse_search_param(const nlohmann::json& conf, | ||
typename cuvs::bench::cuvs_vamana<T, IdxT>::search_param& param) | ||
{ | ||
if (conf.contains("L_search")) { param.L_search = conf.at("L_search"); } | ||
if (conf.contains("num_threads")) { param.num_threads = conf.at("num_threads"); } | ||
} | ||
|
||
template <typename T> | ||
auto create_algo(const std::string& algo_name, | ||
const std::string& distance, | ||
int dim, | ||
const nlohmann::json& conf) -> std::unique_ptr<cuvs::bench::algo<T>> | ||
{ | ||
[[maybe_unused]] cuvs::bench::Metric metric = parse_metric(distance); | ||
std::unique_ptr<cuvs::bench::algo<T>> a; | ||
|
||
if constexpr (std::is_same_v<T, float> or std::is_same_v<T, std::uint8_t>) { | ||
if (algo_name == "cuvs_vamana") { | ||
typename cuvs::bench::cuvs_vamana<T, uint32_t>::build_param param; | ||
parse_build_param<T, uint32_t>(conf, param); | ||
a = std::make_unique<cuvs::bench::cuvs_vamana<T, uint32_t>>(metric, dim, param); | ||
} | ||
} | ||
|
||
if (!a) { throw std::runtime_error("invalid algo: '" + algo_name + "'"); } | ||
|
||
return a; | ||
} | ||
|
||
template <typename T> | ||
auto create_search_param(const std::string& algo_name, const nlohmann::json& conf) | ||
-> std::unique_ptr<typename cuvs::bench::algo<T>::search_param> | ||
{ | ||
if (algo_name == "cuvs_vamana") { | ||
auto param = std::make_unique<typename cuvs::bench::cuvs_vamana<T, uint32_t>::search_param>(); | ||
parse_search_param<T, uint32_t>(conf, *param); | ||
return param; | ||
} | ||
|
||
throw std::runtime_error("invalid algo: '" + algo_name + "'"); | ||
} | ||
|
||
} // namespace cuvs::bench | ||
|
||
REGISTER_ALGO_INSTANCE(float); | ||
|
||
#ifdef ANN_BENCH_BUILD_MAIN | ||
#include "../common/benchmark.hpp" | ||
/* | ||
[NOTE] Dear developer, | ||
|
||
Please don't modify the content of the `main` function; this will make the behavior of the benchmark | ||
executable differ depending on the cmake flags and will complicate the debugging. In particular, | ||
don't try to setup an RMM memory resource here; it will anyway be modified by the memory resource | ||
set on per-algorithm basis. For example, see `cuvs/cuvs_ann_bench_utils.h`. | ||
*/ | ||
int main(int argc, char** argv) { return cuvs::bench::run_main(argc, argv); } | ||
#endif |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does MSFT DiskANN repo not support ARM?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they have
mkl-devel
as a dependency, which is not meant to be installed in aarch64.