Skip to content
Open
Show file tree
Hide file tree
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
21 changes: 18 additions & 3 deletions apps/build_memory_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ namespace po = boost::program_options;

int main(int argc, char **argv)
{
std::string data_type, dist_fn, data_path, index_path_prefix, label_file, universal_label, label_type;
uint32_t num_threads, R, L, Lf, build_PQ_bytes;
std::string data_type, dist_fn, data_path, index_path_prefix, label_file, universal_label, label_type, seller_file;
uint32_t num_threads, R, L, Lf, build_PQ_bytes, num_diverse_build;
float alpha;
bool use_pq_build, use_opq;
bool diverse_index=false;

po::options_description desc{
program_options_utils::make_program_description("build_memory_index", "Build a memory-based DiskANN index.")};
Expand Down Expand Up @@ -70,6 +71,12 @@ int main(int argc, char **argv)
program_options_utils::FILTERED_LBUILD);
optional_configs.add_options()("label_type", po::value<std::string>(&label_type)->default_value("uint"),
program_options_utils::LABEL_TYPE_DESCRIPTION);
optional_configs.add_options()("seller_file", po::value<std::string>(&seller_file)->default_value(""),
program_options_utils::DIVERSITY_FILE);
optional_configs.add_options()("NumDiverse", po::value<uint32_t>(&num_diverse_build)->default_value(1),
program_options_utils::NUM_DIVERSE);



// Merge required and optional parameters
desc.add(required_configs).add(optional_configs);
Expand Down Expand Up @@ -112,6 +119,9 @@ int main(int argc, char **argv)
return -1;
}

if(seller_file != "")
diverse_index = true;

try
{
diskann::cout << "Starting index build with R: " << R << " Lbuild: " << L << " alpha: " << alpha
Expand All @@ -120,11 +130,16 @@ int main(int argc, char **argv)
size_t data_num, data_dim;
diskann::get_bin_metadata(data_path, data_num, data_dim);

std::cout<<"Num diverse build: " << num_diverse_build << std::endl;

auto index_build_params = diskann::IndexWriteParametersBuilder(L, R)
.with_filter_list_size(Lf)
.with_alpha(alpha)
.with_saturate_graph(false)
.with_num_threads(num_threads)
.with_diverse_index(diverse_index)
.with_seller_file(seller_file)
.with_num_diverse_build(num_diverse_build)
.build();

auto filter_params = diskann::IndexFilterParamsBuilder()
Expand Down Expand Up @@ -161,4 +176,4 @@ int main(int argc, char **argv)
diskann::cerr << "Index build failed." << std::endl;
return -1;
}
}
}
3 changes: 2 additions & 1 deletion apps/build_stitched_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,9 @@ int main(int argc, char **argv)

path labels_file_to_use = final_index_path_prefix + "_label_formatted.txt";
path labels_map_file = final_index_path_prefix + "_labels_map.txt";
uint32_t universal_label_id = 0;

convert_labels_string_to_int(label_data_path, labels_file_to_use, labels_map_file, universal_label);
convert_labels_string_to_int(label_data_path, labels_file_to_use, labels_map_file, universal_label, universal_label_id);

// 2. parse label file and create necessary data structures
std::vector<label_set> point_ids_to_labels;
Expand Down
Loading