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

add num_Threads to indexwriteparams in sharded build #438

Merged
merged 1 commit into from
Aug 24, 2023
Merged
Changes from all commits
Commits
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
18 changes: 11 additions & 7 deletions src/disk_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -692,18 +692,22 @@ int build_merged_vamana_index(std::string base_file, diskann::Metric compareMetr

std::string shard_index_file = merged_index_prefix + "_subshard-" + std::to_string(p) + "_mem.index";

diskann::IndexWriteParameters paras =
diskann::IndexWriteParametersBuilder(L, (2 * R / 3)).with_filter_list_size(Lf).build();
diskann::IndexWriteParameters low_degree_params = diskann::IndexWriteParametersBuilder(L, 2 * R / 3)
.with_filter_list_size(Lf)
.with_saturate_graph(false)
.with_num_threads(num_threads)
.build();

uint64_t shard_base_dim, shard_base_pts;
get_bin_metadata(shard_base_file, shard_base_pts, shard_base_dim);

diskann::Index<T> _index(
compareMetric, shard_base_dim, shard_base_pts, std::make_shared<diskann::IndexWriteParameters>(paras),
nullptr, paras.num_frozen_points, false, false, false, build_pq_bytes > 0, build_pq_bytes, use_opq);
diskann::Index<T> _index(compareMetric, shard_base_dim, shard_base_pts,
std::make_shared<diskann::IndexWriteParameters>(low_degree_params), nullptr,
low_degree_params.num_frozen_points, false, false, false, build_pq_bytes > 0,
build_pq_bytes, use_opq);
if (!use_filters)
{
_index.build(shard_base_file.c_str(), shard_base_pts, paras);
_index.build(shard_base_file.c_str(), shard_base_pts, low_degree_params);
}
else
{
Expand All @@ -713,7 +717,7 @@ int build_merged_vamana_index(std::string base_file, diskann::Metric compareMetr
LabelT unv_label_as_num = 0;
_index.set_universal_label(unv_label_as_num);
}
_index.build_filtered_index(shard_base_file.c_str(), shard_labels_file, shard_base_pts, paras);
_index.build_filtered_index(shard_base_file.c_str(), shard_labels_file, shard_base_pts, low_degree_params);
}
_index.save(shard_index_file.c_str());
// copy universal label file from first shard to the final destination
Expand Down
Loading