CagraSearchParams

View as Markdown

Java package: com.nvidia.cuvs

public class CagraSearchParams

CagraSearchParams encapsulates the logic for configuring and holding search parameters.

Public Members

SINGLE_CTA

SINGLE_CTA(0), /** * for small batch sizes */ MULTI_CTA(1), /** * MULTI_KERNEL */ MULTI_KERNEL(2), /** * AUTO */ AUTO(100)

for large batch sizes

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:35

MULTI_CTA

MULTI_CTA(1), /** * MULTI_KERNEL */ MULTI_KERNEL(2), /** * AUTO */ AUTO(100)

for small batch sizes

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:39

MULTI_KERNEL

MULTI_KERNEL(2), /** * AUTO */ AUTO(100)

MULTI_KERNEL

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:43

AUTO

AUTO(100)

AUTO

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:47

HASH

HASH(0), /** * SMALL */ SMALL(1), /** * AUTO_HASH */ AUTO_HASH(100)

HASH

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:66

SMALL

SMALL(1), /** * AUTO_HASH */ AUTO_HASH(100)

SMALL

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:70

AUTO_HASH

AUTO_HASH(100)

AUTO_HASH

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:74

CagraSearchParams

private CagraSearchParams( int maxQueries, int iTopKSize, int maxIterations, SearchAlgo searchAlgo, int teamSize, int searchWidth, int minIterations, int threadBlockSize, HashMapMode hashmapMode, int hashmapMinBitlen, float hashmapMaxFillRate, int numRandomSamplings, long randXORMask)

Constructs an instance of CagraSearchParams with passed search parameters.

Parameters

NameDescription
maxQueriesthe maximum number of queries to search at the same time (batch size)
iTopKSizethe number of intermediate search results retained during the search
maxIterationsthe upper limit of search iterations
searchAlgothe search implementation is configured
teamSizethe number of threads used to calculate a single distance
searchWidththe number of graph nodes to select as the starting point for the search in each iteration
minIterationsthe lower limit of search iterations
threadBlockSizethe thread block size
hashmapModethe hash map type configured
hashmapMinBitlenthe lower limit of hash map bit length
hashmapMaxFillRatethe upper limit of hash map fill rate
numRandomSamplingsthe number of iterations of initial random seed node selection
randXORMaskthe bit mask used for initial random seed node selection

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:109

getMaxQueries

public int getMaxQueries()

Gets the maximum number of queries to search at the same time (batch size).

Returns

the maximum number of queries

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:143

getITopKSize

public int getITopKSize()

Gets the number of intermediate search results retained during the search.

Returns

the number of intermediate search results

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:152

getMaxIterations

public int getMaxIterations()

Gets the upper limit of search iterations.

Returns

the upper limit value

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:161

getTeamSize

public int getTeamSize()

Gets the number of threads used to calculate a single distance.

Returns

the number of threads configured

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:170

getSearchWidth

public int getSearchWidth()

Gets the number of graph nodes to select as the starting point for the search in each iteration.

Returns

the number of graph nodes

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:180

getMinIterations

public int getMinIterations()

Gets the lower limit of search iterations.

Returns

the lower limit value

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:189

getThreadBlockSize

public int getThreadBlockSize()

Gets the thread block size.

Returns

the thread block size

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:198

getHashmapMinBitlen

public int getHashmapMinBitlen()

Gets the lower limit of hash map bit length.

Returns

the lower limit value

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:207

getNumRandomSamplings

public int getNumRandomSamplings()

Gets the number of iterations of initial random seed node selection.

Returns

the number of iterations

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:216

getHashMapMaxFillRate

public float getHashMapMaxFillRate()

Gets the upper limit of hash map fill rate.

Returns

the upper limit of hash map fill rate

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:225

getRandXORMask

public long getRandXORMask()

Gets the bit mask used for initial random seed node selection.

Returns

the bit mask value

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:234

getCagraSearchAlgo

public SearchAlgo getCagraSearchAlgo()

Gets which search implementation is configured.

Returns

the configured SearchAlgo

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:243

getHashMapMode

public HashMapMode getHashMapMode()

Gets the hash map mode configured.

Returns

the configured HashMapMode

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:252

Builder

public Builder()

Default constructor.

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:309

withMaxQueries

public Builder withMaxQueries(int maxQueries)

Sets the maximum number of queries to search at the same time (batch size). Auto select when 0.

Parameters

NameDescription
maxQueriesthe maximum number of queries

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:318

withItopkSize

public Builder withItopkSize(int iTopKSize)

Sets the number of intermediate search results retained during the search. This is the main knob to adjust trade off between accuracy and search speed. Higher values improve the search accuracy.

Parameters

NameDescription
iTopKSizethe number of intermediate search results

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:331

withMaxIterations

public Builder withMaxIterations(int maxIterations)

Sets the upper limit of search iterations. Auto select when 0.

Parameters

NameDescription
maxIterationsthe upper limit of search iterations

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:342

withAlgo

public Builder withAlgo(SearchAlgo cuvsCagraSearchAlgo)

Sets which search implementation to use.

Parameters

NameDescription
cuvsCagraSearchAlgothe SearchAlgo to use

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:353

withTeamSize

public Builder withTeamSize(int teamSize)

Sets the number of threads used to calculate a single distance. 4, 8, 16, or 32.

Parameters

NameDescription
teamSizethe number of threads used to calculate a single distance

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:365

withSearchWidth

public Builder withSearchWidth(int searchWidth)

Sets the number of graph nodes to select as the starting point for the search in each iteration.

Parameters

NameDescription
searchWidththe number of graph nodes to select

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:377

withMinIterations

public Builder withMinIterations(int minIterations)

Sets the lower limit of search iterations.

Parameters

NameDescription
minIterationsthe lower limit of search iterations

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:388

withThreadBlockSize

public Builder withThreadBlockSize(int threadBlockSize)

Sets the thread block size. 0, 64, 128, 256, 512, 1024. Auto selection when 0.

Parameters

NameDescription
threadBlockSizethe thread block size

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:400

withHashMapMode

public Builder withHashMapMode(HashMapMode hashMapMode)

Sets the hash map type. Auto selection when AUTO.

Parameters

NameDescription
hashMapModethe HashMapMode

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:411

withHashMapMinBitlen

public Builder withHashMapMinBitlen(int hashMapMinBitlen)

Sets the lower limit of hash map bit length. More than 8.

Parameters

NameDescription
hashMapMinBitlenthe lower limit of hash map bit length

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:422

withHashMapMaxFillRate

public Builder withHashMapMaxFillRate(float hashMapMaxFillRate)

Sets the upper limit of hash map fill rate. More than 0.1, less than 0.9.

Parameters

NameDescription
hashMapMaxFillRatethe upper limit of hash map fill rate

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:433

withNumRandomSamplings

public Builder withNumRandomSamplings(int numRandomSamplings)

Sets the number of iterations of initial random seed node selection. 1 or more.

Parameters

NameDescription
numRandomSamplingsthe number of iterations of initial random seed node selection

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:446

withRandXorMask

public Builder withRandXorMask(long randXORMask)

Sets the bit mask used for initial random seed node selection.

Parameters

NameDescription
randXORMaskthe bit mask used for initial random seed node selection

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:457

build

public CagraSearchParams build()

Builds an instance of CagraSearchParams with passed search parameters.

Returns

an instance of CagraSearchParams

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:468

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraSearchParams.java:13