| 23 | static size_t test_round = 5; |
| 24 | |
| 25 | int main(int argc, char** argv) { |
| 26 | if (argc < 4) { |
| 27 | std::cerr << "Usage: " << argv[0] << " <arg1> <arg2> <arg3> <arg4>\n" |
| 28 | << "arg1: path for index \n" |
| 29 | << "arg2: path for query file, format .fvecs\n" |
| 30 | << "arg3: path for groundtruth file format .ivecs\n" |
| 31 | << "arg4: whether use high accuracy fastscan, (\"true\" or \"false\"), " |
| 32 | "true by default\n\n"; |
| 33 | exit(1); |
| 34 | } |
| 35 | |
| 36 | char* index_file = argv[1]; |
| 37 | char* query_file = argv[2]; |
| 38 | char* gt_file = argv[3]; |
| 39 | bool use_hacc = true; |
| 40 | |
| 41 | if (argc > 4) { |
| 42 | std::string hacc_str(argv[4]); |
| 43 | if (hacc_str == "false") { |
| 44 | use_hacc = false; |
| 45 | std::cout << "Do not use Hacc FastScan\n"; |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | data_type query; |
| 50 | gt_type gt; |
| 51 | rabitqlib::load_vecs<float, data_type>(query_file, query); |
| 52 | rabitqlib::load_vecs<uint32_t, gt_type>(gt_file, gt); |
| 53 | size_t nq = query.rows(); |
| 54 | size_t total_count = nq * topk; |
| 55 | |
| 56 | index_type ivf; |
| 57 | ivf.load(index_file); |
| 58 | |
| 59 | std::vector<size_t> all_nprobes; |
| 60 | all_nprobes.push_back(5); |
| 61 | for (size_t i = 10; i < 200; i += 10) { |
| 62 | all_nprobes.push_back(i); |
| 63 | } |
| 64 | for (size_t i = 200; i < 400; i += 40) { |
| 65 | all_nprobes.push_back(i); |
| 66 | } |
| 67 | for (size_t i = 400; i <= 1500; i += 100) { |
| 68 | all_nprobes.push_back(i); |
| 69 | } |
| 70 | for (size_t i = 2000; i <= 4000; i += 500) { |
| 71 | all_nprobes.push_back(i); |
| 72 | } |
| 73 | |
| 74 | all_nprobes.push_back(6000); |
| 75 | all_nprobes.push_back(10000); |
| 76 | all_nprobes.push_back(15000); |
| 77 | |
| 78 | rabitqlib::StopW stopw; |
| 79 | |
| 80 | auto nprobes = get_nprobes(ivf, all_nprobes, query, gt); |
| 81 | size_t length = nprobes.size(); |
| 82 |
nothing calls this directly
no test coverage detected