Skip to content

Commit

Permalink
add num_Threads to indexwriteparams in sharded build (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
harsha-simhadri authored Aug 24, 2023
1 parent 9622d8f commit b05c2dc
Showing 1 changed file with 11 additions and 7 deletions.
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

0 comments on commit b05c2dc

Please sign in to comment.