Skip to content

Commit cba8e65

Browse files
committed
Use HNSW GPU hierarchy by default
1 parent 4fa9ab4 commit cba8e65

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

cpp/include/cuvs/neighbors/hnsw.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ enum class HnswHierarchy {
4040

4141
struct index_params : cuvs::neighbors::index_params {
4242
/** Hierarchy build type for HNSW index when converting from CAGRA index */
43-
HnswHierarchy hierarchy = HnswHierarchy::NONE;
43+
HnswHierarchy hierarchy = HnswHierarchy::GPU;
4444
/** Size of the candidate list during hierarchy construction when hierarchy is `CPU`*/
4545
int ef_construction = 200;
4646
/** Number of host threads to use to construct hierarchy when hierarchy is `CPU` or `GPU`.

examples/cpp/src/cagra_hnsw_ace_example.cu

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,8 @@ void cagra_build_search_ace(raft::device_resources const& dev_resources,
8181
// descriptor For in-memory indices: creates HNSW index in memory
8282
std::cout << "Converting CAGRA index to HNSW" << std::endl;
8383
hnsw::index_params hnsw_params;
84-
auto hnsw_index = hnsw::from_cagra(dev_resources, hnsw_params, index);
84+
hnsw_params.hierarchy = hnsw::HnswHierarchy::GPU; // Offload hierarchy construction to GPU
85+
auto hnsw_index = hnsw::from_cagra(dev_resources, hnsw_params, index);
8586

8687
// HNSW search requires host matrices
8788
auto queries_host = raft::make_host_matrix<float, int64_t>(n_queries, queries.extent(1));

0 commit comments

Comments
 (0)