[BUG] cuvs-java: creating a carga index with a single vectors fails with cudaErrorIllegalAddress:an illegal memory access was encountered
Nobody has claimed this yet.
- Dominant language
- Cuda
- Stars
- 854
- Forks
- 236
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 62
Description
Describe the bug
Creating a carga index with a single vectors fails with cudaErrorIllegalAddress:an illegal memory access was encountered
Steps/Code to reproduce bug
// This is a non-realistic trivial dataset, with just a single small
// vector. It demonstrates that trying to build a cagra index with a
// single vector fails. Such a scenario can happen when data is indexed
// and merged across shards, e.g. in Lucene or Elasticsearch.
@Test
public void testIndexAndSearchSingle() throws Throwable {
float[][] dataset = {
{ 0.74021935f, 0.9209938f }
};
try (CuVSResources resources = CuVSResources.create()) {
CagraIndexParams indexParams = new CagraIndexParams.Builder()
.withCagraGraphBuildAlgo(CagraGraphBuildAlgo.NN_DESCENT)
.withGraphDegree(1)
.withIntermediateGraphDegree(2)
.withNumWriterThreads(32)
.withMetric(CuvsDistanceType.L2Expanded)
.build();
CagraIndex index = CagraIndex.newBuilder(resources)
.withDataset(dataset)
.withIndexParams(indexParams)
.build();
index.destroyIndex();
}
}
Expected behavior
It will simply java clients if they do not have to special case when the dataset contain a single vector.
Environment details (please complete the following information):
- Environment location: [Bare-metal, Docker, Cloud(specify cloud provider)]
- AWS g4dn.2xlarge, Ubuntu 22.04 + cuda 12.6
set the JAVA_HOME env variable to JDK 22
JAVA_HOME=/home/ubuntu/binaries/jdk-22.0.2/
Additional context
Fails on branch-25.02
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the testIndexAndSearchSingle reproduction and the CagraIndex.newBuilder call on branch-25.02, then run the provided single-vector dataset case in the stated CUDA 12.6 environment. Done means creating and destroying the index completes without cudaErrorIllegalAddress.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- machine-learning
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100