Skip to navigation

AcceleratedHNSWParams

View as Markdown

Java package: com.nvidia.cuvs.lucene

public class AcceleratedHNSWParams

Public Members

getWriterThreads

public int getWriterThreads()

Get the cuVS writer threads parameter

Returns

cuVS writer threads parameter

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:147

getIntermediateGraphDegree

public int getIntermediateGraphDegree()

Get the intermediate graph degree

Returns

the graph degree parameter

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:156

getGraphdegree

public int getGraphdegree()

Get the graph degree

Returns

the graph degree parameter

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:165

getHnswLayers

public int getHnswLayers()

Get the number of HNSW layers

Returns

the number of HNSW layers

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:174

getMaxConn

public int getMaxConn()

Get the max connection parameter

Returns

the max connection parameter

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:183

getBeamWidth

public int getBeamWidth()

Get the beam width parameter

Returns

the beam width parameter

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:192

getCagraGraphBuildAlgo

public CagraGraphBuildAlgo getCagraGraphBuildAlgo()

Get the CAGRA graph build algorithm

Returns

the CAGRA graph build algorithm

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:201

getCuVSIvfPqParams

public CuVSIvfPqParams getCuVSIvfPqParams()

Get the instance of CuVSIvfPqParams

Returns

the instance of CuVSIvfPqParams

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:210

getNumMergeWorkers

public int getNumMergeWorkers()

Get the number of merge workers set to be used in the fallback mechanism

Returns

the number of merge workers

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:219

getMergeExec

public ExecutorService getMergeExec()

Get the instance of the ExecutorService to be used in the fallback mechanism

Returns

the instance of the ExecutorService

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:228

getStrategy

public Strategy getStrategy()

Get the chosen strategy:

When HEURISTIC [Default] is chosen, the CAGRA build algorithm and its indexing parameters are automatically chosen based on the size of the data set When CUSTOM is chosen, the build algorithm and its parameters (either defaults or overridden values with the use of With* methods) is used internally

Returns

get the chosen Strategy

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:240

getCuvsDistanceType

public CuvsDistanceType getCuvsDistanceType()

Get the cuvs distance type

Returns

the distance type

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:249

getNNDescentNumIterations

public int getNNDescentNumIterations()

get the number of Iterations to run if building with NN_DESCENT

Returns

the number of iterations for NN_DESCENT

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:258

getHnswHeuristicType

public HnswHeuristicType getHnswHeuristicType()

Get the heuristic cuVS applies when deriving the CAGRA build parameters from maxConn and beamWidth. Only consulted under the Strategy#HEURISTIC strategy.

Returns

the HnswHeuristicType to hand to cuVS

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:268

withWriterThreads

public Builder withWriterThreads(int writerThreads)

Set the number of cuVS writer threads while building the index Valid range - Minimum: MIN_WRITER_THREADS, Maximum: MAX_WRITER_THREADS Default value - DEFAULT_WRITER_THREADS

Parameters

NameDescription
writerThreads

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:333

withIntermediateGraphDegree

public Builder withIntermediateGraphDegree(int intermediateGraphDegree)

Set the intermediate graph degree to use while building CAGRA index Valid range - Minimum: MIN_INT_GRAPH_DEG, Maximum: MAX_INT_GRAPH_DEG Default value - DEFAULT_INT_GRAPH_DEGREE

Parameters

NameDescription
intermediateGraphDegree

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:346

withGraphDegree

public Builder withGraphDegree(int graphDegree)

Set the graph degree to use while building CAGRA index Valid range - Minimum: MIN_GRAPH_DEG, Maximum: MAX_GRAPH_DEG Default value - DEFAULT_GRAPH_DEGREE

With the CUSTOM strategy, the degree cuVS builds (this value, lowered to the intermediate graph degree if that is smaller) must be at most 2 * maxConn: the graph is written as an HNSW graph, which holds at most 2 * maxConn neighbors per node on level 0.

Parameters

NameDescription
graphDegree

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:363

withHNSWLayer

public Builder withHNSWLayer(int hnswLayers)

Set the number of HNSW layers to construct while building the HNSW index Valid range - Minimum: MIN_HNSW_LAYERS, Maximum: MAX_HNSW_LAYERS Default value - DEFAULT_HNSW_LAYERS

Parameters

NameDescription
hnswLayersthe number of HNSW layers

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:376

withMaxConn

public Builder withMaxConn(int maxConn)

Set the HNSW max connections parameter (M) Valid range - Minimum: MIN_MAX_CONN, Maximum: MAX_MAX_CONN Default value - DEFAULT_MAX_CONN

The CPU fallback builds the graph with it, every segment records it as its M, and it bounds the GPU-built graph: at most 2 * maxConn neighbors per node on level 0 (with the CUSTOM strategy, the graph degree must not exceed that) and at most maxConn on the upper layers.

Parameters

NameDescription
maxConnthe max connections parameter

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:394

withBeamWidth

public Builder withBeamWidth(int beamWidth)

Set the beam width parameter while building HNSW index with fallback mechanism Valid range - Minimum: MIN_BEAM_WIDTH, Maximum: MAX_BEAM_WIDTH Default value - DEFAULT_BEAM_WIDTH

Parameters

NameDescription
beamWidththe beam width parameter

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:407

withCagraGraphBuildAlgo

public Builder withCagraGraphBuildAlgo(CagraGraphBuildAlgo cagraGraphBuildAlgo)

Set the CAGRA graph build algorithm to use Default value - NN_DESCENT

Parameters

NameDescription
cagraGraphBuildAlgo

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:419

withCuVSIvfPqParams

public Builder withCuVSIvfPqParams(CuVSIvfPqParams cuVSIvfPqParams)

Set the instance of CuVSIvfPqParams

Parameters

NameDescription
cuVSIvfPqParams

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:430

withNumMergeWorkers

public Builder withNumMergeWorkers(int numMergeWorkers)

Set the number of merge workers to be used with the fallback mechanism Default value - DEFAULT_NUM_MERGE_WORKERS

Parameters

NameDescription
numMergeWorkersnumber of merge workers to set

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:442

withMergeExecutorService

public Builder withMergeExecutorService(ExecutorService mergeExec)

Set the merge executor service to be used in the fallback mechanism Default value an instance with one thread

Parameters

NameDescription
mergeExecan instance of ExecutorService

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:454

withStrategy

public Builder withStrategy(Strategy strategy)

Set the chosen strategy:

When HEURISTIC [Default] is chosen, the CAGRA build algorithm and its indexing parameters are automatically chosen based on the size of the data set When CUSTOM is chosen, the build algorithm and its parameters (either defaults or overridden values with the use of With* methods) is used internally

Valid options - HEURISTIC, CUSTOM Default value - HEURISTIC

Parameters

NameDescription
strategy, the strategy to choose

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:471

withCuvsDistanceType

public Builder withCuvsDistanceType(CuvsDistanceType cuvsDistanceType)

Set the CuvsDistanceType

Parameters

NameDescription
cuvsDistanceTypethe CuvsDistanceType to set

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:482

withNNDescentNumIterations

public Builder withNNDescentNumIterations(int nnDescentNumIterations)

Set the number of Iterations to run if building with NN_DESCENT

Valid range - Minimum: MIN_NN_DESCENT_NUM_ITERATIONS, Maximum: MAX_NN_DESCENT_NUM_ITERATIONS Default value - DEFAULT_NN_DESCENT_NUM_ITERATIONS

Parameters

NameDescription
nnDescentNumIterationsnumber of merge workers to set

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:496

withHnswHeuristicType

public Builder withHnswHeuristicType(HnswHeuristicType hnswHeuristicType)

Set the heuristic cuVS applies when deriving the CAGRA build parameters from maxConn and beamWidth. Only consulted under the Strategy#HEURISTIC strategy.

Default value - SAME_GRAPH_FOOTPRINT, which targets a CAGRA graph of the same on-disk size as the equivalent HNSW graph (graph degree = 2 * maxConn).

Parameters

NameDescription
hnswHeuristicTypethe HnswHeuristicType to hand to cuVS

Returns

instance of Builder

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:511

build

public AcceleratedHNSWParams build()

Create an instance of AcceleratedHNSWParams

Returns

instance of AcceleratedHNSWParams

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:584

Source: java/cuvs-lucene/src/main/java/com/nvidia/cuvs/lucene/AcceleratedHNSWParams.java:17