Skip to content

Commit 1041ff7

Browse files
committed
clean up code
1 parent 4018ab7 commit 1041ff7

2 files changed

Lines changed: 0 additions & 139 deletions

File tree

include/index.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ template <typename T, typename TagT = uint32_t, typename LabelT = uint32_t> clas
8080
#ifdef EXEC_ENV_OLS
8181
DISKANN_DLLEXPORT void load(AlignedFileReader &reader, uint32_t num_threads, uint32_t search_l);
8282
#else
83-
// Reads the number of frozen points from graph's metadata file section.
84-
// DISKANN_DLLEXPORT static size_t get_graph_num_frozen_points(const std::string &graph_file);
85-
8683
DISKANN_DLLEXPORT void load(const char *index_file, uint32_t num_threads, uint32_t search_l);
8784
#endif
8885

@@ -180,9 +177,6 @@ template <typename T, typename TagT = uint32_t, typename LabelT = uint32_t> clas
180177

181178
DISKANN_DLLEXPORT bool is_index_saved();
182179

183-
// repositions frozen points to the end of _data - if they have been moved
184-
// during deletion
185-
// DISKANN_DLLEXPORT void reposition_frozen_point_to_end();
186180
DISKANN_DLLEXPORT void reposition_points(uint32_t old_location_start, uint32_t new_location_start,
187181
uint32_t num_locations);
188182

@@ -249,10 +243,6 @@ template <typename T, typename TagT = uint32_t, typename LabelT = uint32_t> clas
249243
// Acquire exclusive _update_lock before calling
250244
void build_with_data_populated(const std::vector<TagT> &tags);
251245

252-
// generates 1 frozen point that will never be deleted from the graph
253-
// This is not visible to the user
254-
// void generate_frozen_point();
255-
256246
// determines navigating node of the graph by calculating medoid of datafopt
257247
uint32_t calculate_entry_point();
258248

@@ -323,7 +313,6 @@ template <typename T, typename TagT = uint32_t, typename LabelT = uint32_t> clas
323313
// graph, mode = _consolidated_order in case of lazy deletion and
324314
// _compacted_order in case of eager deletion
325315
DISKANN_DLLEXPORT void compact_data();
326-
// DISKANN_DLLEXPORT void compact_frozen_point();
327316

328317
// Remove deleted nodes from adjacency list of node loc
329318
// Replace removed neighbors with second order neighbors.
@@ -369,13 +358,6 @@ template <typename T, typename TagT = uint32_t, typename LabelT = uint32_t> clas
369358
size_t _nd = 0; // number of active points i.e. existing in the graph
370359
size_t _max_points = 0; // total number of points in given data set
371360

372-
// _num_frozen_pts is the number of points which are used as initial
373-
// candidates when iterating to closest point(s). These are not visible
374-
// externally and won't be returned by search. At least 1 frozen point is
375-
// needed for a dynamic index. The frozen points have consecutive locations.
376-
// See also _start below.
377-
// size_t _num_frozen_pts = 0;
378-
// size_t _frozen_pts_used = 0;
379361
size_t _node_size;
380362
size_t _data_len;
381363
size_t _neighbor_len;

src/index.cpp

Lines changed: 0 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,6 @@ Index<T, TagT, LabelT>::Index(const IndexConfig &index_config, std::shared_ptr<A
6161
-1, __FUNCSIG__, __FILE__, __LINE__);
6262
}
6363

64-
//if (_dynamic_index && _num_frozen_pts == 0)
65-
//{
66-
// _num_frozen_pts = 1;
67-
//}
6864
// Sanity check. While logically it is correct, max_points = 0 causes
6965
// downstream problems.
7066
if (_max_points == 0)
@@ -276,7 +272,6 @@ void Index<T, TagT, LabelT>::save(const char *filename, bool compact_before_save
276272
if (compact_before_save)
277273
{
278274
compact_data();
279-
// compact_frozen_point();
280275
}
281276
else
282277
{
@@ -386,10 +381,6 @@ void Index<T, TagT, LabelT>::save(const char *filename, bool compact_before_save
386381
<< std::endl;
387382
}
388383

389-
// If frozen points were temporarily compacted to _nd, move back to
390-
// _max_points.
391-
//reposition_frozen_point_to_end();
392-
393384
diskann::cout << "Time taken for save: " << timer.elapsed() / 1000000.0 << "s." << std::endl;
394385
}
395386

@@ -668,7 +659,6 @@ void Index<T, TagT, LabelT>::load(const char *filename, uint32_t num_threads, ui
668659
+ _table_stats.label_mem_usage
669660
+ _table_stats.tag_memory_usage;
670661

671-
// reposition_frozen_point_to_end();
672662
diskann::cout << " _nd: " << _nd << " _start: " << _start
673663
<< " size(_location_to_tag): " << _location_to_tag.size()
674664
<< " size(_tag_to_location):" << _tag_to_location.size() << " Max points: " << _max_points
@@ -685,27 +675,6 @@ void Index<T, TagT, LabelT>::load(const char *filename, uint32_t num_threads, ui
685675
}
686676
}
687677

688-
#ifndef EXEC_ENV_OLS
689-
//template <typename T, typename TagT, typename LabelT>
690-
//size_t Index<T, TagT, LabelT>::get_graph_num_frozen_points(const std::string &graph_file)
691-
//{
692-
// size_t expected_file_size;
693-
// uint32_t max_observed_degree, start;
694-
// size_t file_frozen_pts;
695-
//
696-
// std::ifstream in;
697-
// in.exceptions(std::ios::badbit | std::ios::failbit);
698-
//
699-
// in.open(graph_file, std::ios::binary);
700-
// in.read((char *)&expected_file_size, sizeof(size_t));
701-
// in.read((char *)&max_observed_degree, sizeof(uint32_t));
702-
// in.read((char *)&start, sizeof(uint32_t));
703-
// in.read((char *)&file_frozen_pts, sizeof(size_t));
704-
//
705-
// return file_frozen_pts;
706-
//}
707-
#endif
708-
709678
#ifdef EXEC_ENV_OLS
710679
template <typename T, typename TagT, typename LabelT>
711680
size_t Index<T, TagT, LabelT>::load_graph(AlignedFileReader &reader, size_t expected_num_points)
@@ -718,7 +687,6 @@ size_t Index<T, TagT, LabelT>::load_graph(std::string filename, size_t expected_
718687
#endif
719688
auto res = _graph_store->load(filename, expected_num_points);
720689
_start = std::get<1>(res);
721-
// _num_frozen_pts = std::get<2>(res);
722690
return std::get<0>(res);
723691
}
724692

@@ -1637,7 +1605,6 @@ void Index<T, TagT, LabelT>::build_with_data_populated(const std::vector<TagT> &
16371605
_data_store->get_aligned_dim());
16381606
}
16391607

1640-
// generate_frozen_point();
16411608
link();
16421609

16431610
size_t max = 0, min = SIZE_MAX, total = 0, cnt = 0;
@@ -2433,40 +2400,6 @@ template <typename T, typename TagT, typename LabelT> size_t Index<T, TagT, Labe
24332400
return _max_points;
24342401
}
24352402

2436-
//template <typename T, typename TagT, typename LabelT> void Index<T, TagT, LabelT>::generate_frozen_point()
2437-
//{
2438-
// if (_num_frozen_pts == 0)
2439-
// return;
2440-
//
2441-
// if (_num_frozen_pts > 1)
2442-
// {
2443-
// throw ANNException("More than one frozen point not supported in generate_frozen_point", -1, __FUNCSIG__,
2444-
// __FILE__, __LINE__);
2445-
// }
2446-
//
2447-
// if (_nd == 0)
2448-
// {
2449-
// throw ANNException("ERROR: Can not pick a frozen point since nd=0", -1, __FUNCSIG__, __FILE__, __LINE__);
2450-
// }
2451-
// size_t res = calculate_entry_point();
2452-
//
2453-
// // REFACTOR PQ: Not sure if we should do this for both stores.
2454-
// if (_pq_dist)
2455-
// {
2456-
// // copy the PQ data corresponding to the point returned by
2457-
// // calculate_entry_point
2458-
// // memcpy(_pq_data + _max_points * _num_pq_chunks,
2459-
// // _pq_data + res * _num_pq_chunks,
2460-
// // _num_pq_chunks * DIV_ROUND_UP(NUM_PQ_BITS, 8));
2461-
// _pq_data_store->copy_vectors((location_t)res, (location_t)_max_points, 1);
2462-
// }
2463-
// else
2464-
// {
2465-
// _data_store->copy_vectors((location_t)res, (location_t)_max_points, 1);
2466-
// }
2467-
// _frozen_pts_used++;
2468-
//}
2469-
24702403
template <typename T, typename TagT, typename LabelT> int Index<T, TagT, LabelT>::enable_delete()
24712404
{
24722405
assert(_enable_tags);
@@ -2584,14 +2517,6 @@ consolidation_report Index<T, TagT, LabelT>::consolidate_deletes(const IndexWrit
25842517
throw ANNException(err, -1, __FUNCSIG__, __FILE__, __LINE__);
25852518
}
25862519

2587-
//if (_location_to_tag.size() + _delete_set->size() != _nd)
2588-
//{
2589-
// diskann::cerr << "Error: _location_to_tag.size (" << _location_to_tag.size() << ") + _delete_set->size ("
2590-
// << _delete_set->size() << ") != _nd(" << _nd << ") ";
2591-
// return consolidation_report(diskann::consolidation_report::status_code::INCONSISTENT_COUNT_ERROR, 0, 0, 0,
2592-
// 0, 0, 0, 0);
2593-
//}
2594-
25952520
if (_location_to_tag.size() != _tag_to_location.size())
25962521
{
25972522
throw diskann::ANNException("_location_to_tag and _tag_to_location not of same size", -1, __FUNCSIG__,
@@ -2663,26 +2588,6 @@ consolidation_report Index<T, TagT, LabelT>::consolidate_deletes(const IndexWrit
26632588
duration);
26642589
}
26652590

2666-
//template <typename T, typename TagT, typename LabelT> void Index<T, TagT, LabelT>::compact_frozen_point()
2667-
//{
2668-
// if (_nd < _max_points && _num_frozen_pts > 0)
2669-
// {
2670-
// reposition_points((uint32_t)_max_points, (uint32_t)_nd, (uint32_t)_num_frozen_pts);
2671-
// _start = (uint32_t)_nd;
2672-
//
2673-
// if (_filtered_index && _dynamic_index)
2674-
// {
2675-
// // update medoid id's as frozen points are treated as medoid
2676-
// for (auto &[label, medoid_id] : _label_to_start_id)
2677-
// {
2678-
// /* if (label == _universal_label)
2679-
// continue;*/
2680-
// _label_to_start_id[label] = (uint32_t)_nd + (medoid_id - (uint32_t)_max_points);
2681-
// }
2682-
// }
2683-
// }
2684-
//}
2685-
26862591
// Should be called after acquiring _update_lock
26872592
template <typename T, typename TagT, typename LabelT> void Index<T, TagT, LabelT>::compact_data()
26882593
{
@@ -2970,32 +2875,6 @@ void Index<T, TagT, LabelT>::reposition_points(uint32_t old_location_start, uint
29702875
_data_store->move_vectors(old_location_start, new_location_start, num_locations);
29712876
}
29722877

2973-
//template <typename T, typename TagT, typename LabelT> void Index<T, TagT, LabelT>::reposition_frozen_point_to_end()
2974-
//{
2975-
// if (_num_frozen_pts == 0)
2976-
// return;
2977-
//
2978-
// if (_nd == _max_points)
2979-
// {
2980-
// diskann::cout << "Not repositioning frozen point as it is already at the end." << std::endl;
2981-
// return;
2982-
// }
2983-
//
2984-
// reposition_points((uint32_t)_nd, (uint32_t)_max_points, (uint32_t)_num_frozen_pts);
2985-
// _start = (uint32_t)_max_points;
2986-
//
2987-
// // update medoid id's as frozen points are treated as medoid
2988-
// if (_filtered_index && _dynamic_index)
2989-
// {
2990-
// for (auto &[label, medoid_id] : _label_to_start_id)
2991-
// {
2992-
// /*if (label == _universal_label)
2993-
// continue;*/
2994-
// _label_to_start_id[label] = (uint32_t)_max_points + (medoid_id - (uint32_t)_nd);
2995-
// }
2996-
// }
2997-
//}
2998-
29992878
template <typename T, typename TagT, typename LabelT> void Index<T, TagT, LabelT>::resize(size_t new_max_points)
30002879
{
30012880
const size_t new_internal_points = new_max_points ;

0 commit comments

Comments
 (0)