Skip to content

Commit

Permalink
randomized start point
Browse files Browse the repository at this point in the history
  • Loading branch information
Amey Varhade committed Oct 24, 2024
1 parent 2e78ef3 commit bad72bb
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 110,580 deletions.
5 changes: 3 additions & 2 deletions apps/search_memory_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ int search_memory_index(diskann::Metric &metric, const std::string &index_path,
double best_recall = 0.0;

for (uint32_t test_id = 0; test_id < Lvec.size(); test_id++)
{
{
std::cout<<"L: "<<test_id<<std::endl;
uint32_t L = Lvec[test_id];
if (L < recall_at)
{
Expand All @@ -160,7 +161,7 @@ int search_memory_index(diskann::Metric &metric, const std::string &index_path,
auto s = std::chrono::high_resolution_clock::now();
omp_set_num_threads(num_threads);
#pragma omp parallel for schedule(dynamic, 1)
for (int64_t i = 0; i < 10; i++)
for (int64_t i = 0; i < (int64_t)query_num; i++)
{
auto qs = std::chrono::high_resolution_clock::now();
if (filtered_search && !tags)
Expand Down
17 changes: 1 addition & 16 deletions apps/utils/compute_groundtruth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,6 @@ std::vector<std::vector<std::pair<uint32_t, float>>> processUnfilteredParts(cons
std::vector<uint32_t> &location_to_tag)
{
float *base_data = nullptr;
//std::cout<<"AMEY: Inside processUnfilteredParts location_to_tag "<<location_to_tag.size()<<std::endl;
int num_parts = get_num_parts<T>(base_file.c_str());
std::vector<std::vector<std::pair<uint32_t, float>>> res(nqueries);
for (int p = 0; p < num_parts; p++)
Expand Down Expand Up @@ -393,20 +392,13 @@ int aux_main(const std::string &base_file, const std::string &query_file, const

// load tags
const bool tags_enabled = tags_file.empty() ? false : true;
//const bool base_file_exists = base_file.empty() ? false : true;
//std::cout<<"AMEY: base_file_exists "<<base_file_exists<<std::endl;
//std::cout<<"AMEY: tags_file "<<tags_file<<std::endl;
//std::cout<<"AMEY: tags_enabled "<<tags_enabled<<std::endl;
std::vector<uint32_t> location_to_tag = diskann::loadTags(tags_file, base_file);

int *closest_points = new int[nqueries * k];
float *dist_closest_points = new float[nqueries * k];

//std::cout<<"AMEY: Inside aux_main location_to_tag "<<location_to_tag.size()<<std::endl;
//std::cout<<"AMEY: in aux_main before processUnfiltered "<<std::endl;
std::vector<std::vector<std::pair<uint32_t, float>>> results =
processUnfilteredParts<T>(base_file, nqueries, npoints, dim, k, query_data, metric, location_to_tag);
//std::cout<<"AMEY: in aux_main after processUnfiltered "<<std::endl;

for (size_t i = 0; i < nqueries; i++)
{
Expand Down Expand Up @@ -437,14 +429,7 @@ int aux_main(const std::string &base_file, const std::string &query_file, const
if (j < k)
std::cout << "WARNING: found less than k GT entries for query " << i << std::endl;
}
std::cout<<"AMEY: tags_enabled "<<tags_enabled<<std::endl;
for(size_t i = 0; i < nqueries; i++){
std::cout<<"query "<<i<<std::endl;
for(size_t j = 0; j < k; j++){
std::cout<<"closest point id "<<closest_points[i*k + j]<<"closest point distance "<<dist_closest_points[i*k + j];
}
std::cout<<std::endl;
}

save_groundtruth_as_one_file(gt_file, closest_points, dist_closest_points, nqueries, k);
delete[] closest_points;
delete[] dist_closest_points;
Expand Down
Loading

0 comments on commit bad72bb

Please sign in to comment.