CagraSearchParams

View as Markdown

Java package: com.nvidia.cuvs

1public class CagraSearchParams

CagraSearchParams encapsulates the logic for configuring and holding search parameters.

Public Members

SINGLE_CTA

1SINGLE_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

1MULTI_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

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

MULTI_KERNEL

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

AUTO

1AUTO(100)

AUTO

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

HASH

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

HASH

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

SMALL

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

SMALL

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

AUTO_HASH

1AUTO_HASH(100)

AUTO_HASH

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

CagraSearchParams

1private 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public Builder()

Default constructor.

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

withMaxQueries

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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

1public 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