From b05c2dcef0a8a3b4bb92c617173efa9fb206e6db Mon Sep 17 00:00:00 2001 From: Harsha Vardhan Simhadri Date: Thu, 24 Aug 2023 09:59:15 -0700 Subject: [PATCH] add num_Threads to indexwriteparams in sharded build (#438) --- src/disk_utils.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/disk_utils.cpp b/src/disk_utils.cpp index 6544df33a..7ea29c49a 100644 --- a/src/disk_utils.cpp +++ b/src/disk_utils.cpp @@ -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 _index( - compareMetric, shard_base_dim, shard_base_pts, std::make_shared(paras), - nullptr, paras.num_frozen_points, false, false, false, build_pq_bytes > 0, build_pq_bytes, use_opq); + diskann::Index _index(compareMetric, shard_base_dim, shard_base_pts, + std::make_shared(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 { @@ -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