Skip to navigation

VamanaIndex

View as Markdown

Java package: com.nvidia.cuvs

public interface VamanaIndex extends AutoCloseable

VamanaIndex encapsulates a Vamana index, along with methods to build it on the GPU and serialize it in the DiskANN file format.

Vamana is the graph construction algorithm behind DiskANN. cuVS currently provides build and serialize only. There is no Vamana search API, so a serialized index is searched by loading it with DiskANN.

Public Members

getDimensions

int getDimensions() throws Throwable

Gets the dimensionality of the vectors in this index.

Returns

the number of dimensions

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:30

serialize

default void serialize(Path filePrefix) throws Throwable

Serializes the index in the DiskANN file format, including the dataset.

This writes two files, filePrefix holding the graph and filePrefix + ".data" holding the dataset.

Parameters

NameDescription
filePrefixthe prefix that output file names are derived from

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:40

serialize

void serialize(Path filePrefix, boolean includeDataset) throws Throwable

Serializes the index in the DiskANN file format.

When includeDataset is true this writes filePrefix holding the graph and filePrefix + ".data" holding the dataset. When it is false only filePrefix is written.

The argument is a prefix and not a complete file name, matching the native file_prefix parameter.

Parameters

NameDescription
filePrefixthe prefix that output file names are derived from
includeDatasetwhether to write the dataset alongside the graph

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:57

getCuVSResources

CuVSResources getCuVSResources()

Gets an instance of CuVSResources

Returns

an instance of CuVSResources

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:64

newBuilder

static Builder newBuilder(CuVSResources cuvsResources)

Creates a new Builder with an instance of CuVSResources.

Parameters

NameDescription
cuvsResourcesan instance of CuVSResources

Throws

TypeDescription
UnsupportedOperationExceptionif the provider does not support cuvs

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:72

withDataset

Builder withDataset(float[][] vectors)

Sets the dataset for building the VamanaIndex.

Parameters

NameDescription
vectorsa two-dimensional float array

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:88

withDataset

Builder withDataset(CuVSMatrix dataset)

Sets the dataset for building the VamanaIndex.

The native builder accepts float, half, uint8, and int8 datasets. Of those, CuVSMatrix.DataType#FLOAT, CuVSMatrix.DataType#HALF, and CuVSMatrix.DataType#BYTE are reachable from Java today, where BYTE is unsigned. int8 has no corresponding DataType.

The native index may retain a non-owning device view of the dataset rather than copying it, so the caller must keep this matrix open for at least as long as the index and close it afterwards. A dataset supplied as a float[][] is created and closed by the index instead.

Parameters

NameDescription
dataseta CuVSMatrix object containing the vectors

Returns

an instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:107

withIndexParams

Builder withIndexParams(VamanaIndexParams vamanaIndexParameters)

Registers an instance of configured VamanaIndexParams with this Builder.

Parameters

NameDescription
vamanaIndexParametersAn instance of VamanaIndexParams

Returns

An instance of this Builder

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:116

build

VamanaIndex build() throws Throwable

Builds and returns an instance of VamanaIndex.

Returns

an instance of VamanaIndex

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:123

Source: java/cuvs-java/src/main/java/com/nvidia/cuvs/VamanaIndex.java:21