Skip to content

Commit 925c2da

Browse files
committed
Fix Java and Python CI failures from the Dataset Specs merge
- Java: upstream #2774 added FromSerializedBuilder.withOutputDataset( DeserializeDataset), but this branch renamed DeserializeDataset to DenseOwningDataset. Update the remaining references in CagraIndex, the java22 CagraIndexImpl and CagraIndexDeprecatedBuilderIT. - Python: common/dataset.pxd cimported cuvsKMeansType from cuvs.cluster.kmeans.kmeans, which imports that module when common.dataset initializes. That loops through cuvs.cluster -> neighbors -> cagra back into the half-initialized common.dataset (ImportError: cannot import name make_device_padded_dataset). Declare the enum locally from cuvs/cluster/kmeans.h instead. Verification - Full cuvs Python suite on GPU against a local libcuvs build: 16663 passed, 168 skipped, 2 xfailed. - Java not compiled locally (no JDK 22 or jextract).
1 parent dc9f53d commit 925c2da

5 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎fern/pages/java_api/java-api-com-nvidia-cuvs-cagraindex.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ default FromSerializedBuilder fromSerialized(InputStream inputStream)
679679
Loads an index written by `CagraIndex#serialize(OutputStream)`, with its graph and
680680
dataset. `FromSerializedBuilder#build()` reads `inputStream` to its end, but
681681
closing it is left to the caller. The index owns the loaded dataset unless
682-
`FromSerializedBuilder#withOutputDataset(DeserializeDataset)` hands it to the caller.
682+
`FromSerializedBuilder#withOutputDataset(DenseOwningDataset)` hands it to the caller.
683683

684684
**Parameters**
685685

@@ -727,7 +727,7 @@ deserialization. The concrete output type must match the dataset layout stored i
727727
serialized index. Keep `outDataset` alive while the built index is in use. Unlike
728728
`#fromSerialized(InputStream)`, `#build()` closes `inputStream`.
729729

730-
**Deprecated:** Use `#fromSerialized(InputStream)` and `FromSerializedBuilder#withOutputDataset(DeserializeDataset)`.
730+
**Deprecated:** Use `#fromSerialized(InputStream)` and `FromSerializedBuilder#withOutputDataset(DenseOwningDataset)`.
731731

732732
**Parameters**
733733

@@ -1027,7 +1027,7 @@ _Source: `java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraIndex.java:727`_
10271027
### withOutputDataset
10281028

10291029
```java
1030-
FromSerializedBuilder withOutputDataset(DeserializeDataset outDataset)
1030+
FromSerializedBuilder withOutputDataset(DenseOwningDataset outDataset)
10311031
```
10321032

10331033
Hands the loaded dataset to the caller instead of the index. `outDataset` must be

‎java/cuvs-java/src/main/java/com/nvidia/cuvs/CagraIndex.java‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ default FromGraphBuilder fromGraph(
509509
* Loads an index written by {@link CagraIndex#serialize(OutputStream)}, with its graph and
510510
* dataset. {@link FromSerializedBuilder#build()} reads {@code inputStream} to its end, but
511511
* closing it is left to the caller. The index owns the loaded dataset unless
512-
* {@link FromSerializedBuilder#withOutputDataset(DeserializeDataset)} hands it to the caller.
512+
* {@link FromSerializedBuilder#withOutputDataset(DenseOwningDataset)} hands it to the caller.
513513
*
514514
* @param inputStream the serialized index
515515
* @return a builder for the optional inputs
@@ -539,7 +539,7 @@ default FromSerializedBuilder fromSerialized(InputStream inputStream) {
539539
* @param outDataset an empty {@link PaddedDataset} or {@link StandardDataset}
540540
* @return an instance of this Builder
541541
* @deprecated Use {@link #fromSerialized(InputStream)} and
542-
* {@link FromSerializedBuilder#withOutputDataset(DeserializeDataset)}.
542+
* {@link FromSerializedBuilder#withOutputDataset(DenseOwningDataset)}.
543543
*/
544544
@Deprecated(since = "26.12", forRemoval = true)
545545
Builder from(InputStream inputStream, DenseOwningDataset outDataset);
@@ -743,7 +743,7 @@ interface FromSerializedBuilder {
743743
* @return this builder
744744
* @throws IllegalStateException if called more than once
745745
*/
746-
FromSerializedBuilder withOutputDataset(DeserializeDataset outDataset);
746+
FromSerializedBuilder withOutputDataset(DenseOwningDataset outDataset);
747747

748748
/**
749749
* Loads the index. A builder creates one index, so this can be called only once,

‎java/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/CagraIndexImpl.java‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1849,7 +1849,7 @@ public CagraIndex build() throws Throwable {
18491849
private static final class FromSerializedBuilderImpl implements CagraIndex.FromSerializedBuilder {
18501850
private final CuVSResources resources;
18511851
private final InputStream inputStream;
1852-
private CagraIndex.DeserializeDataset outDataset;
1852+
private CagraIndex.DenseOwningDataset outDataset;
18531853
private boolean built;
18541854

18551855
FromSerializedBuilderImpl(CuVSResources resources, InputStream inputStream) {
@@ -1859,7 +1859,7 @@ private static final class FromSerializedBuilderImpl implements CagraIndex.FromS
18591859

18601860
@Override
18611861
public CagraIndex.FromSerializedBuilder withOutputDataset(
1862-
CagraIndex.DeserializeDataset outDataset) {
1862+
CagraIndex.DenseOwningDataset outDataset) {
18631863
Objects.requireNonNull(outDataset, "outDataset");
18641864
checkNotSet(this.outDataset, "withOutputDataset");
18651865
this.outDataset = outDataset;

‎java/cuvs-java/src/test/java/com/nvidia/cuvs/CagraIndexDeprecatedBuilderIT.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public void loadsASerializedIndex() throws Throwable {
7474
assertEquals(ROWS, loaded.size());
7575
}
7676
assertTrue(stream.closed);
77-
try (CagraIndex.DeserializeDataset outDataset =
77+
try (CagraIndex.DenseOwningDataset outDataset =
7878
padded ? new CagraIndex.PaddedDataset() : new CagraIndex.StandardDataset();
7979
CagraIndex loaded =
8080
CagraIndex.newBuilder(resources)

‎python/cuvs/cuvs/common/dataset.pxd‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,18 @@
77
from libc.stdint cimport uint32_t
88
from libcpp cimport bool
99

10-
from cuvs.cluster.kmeans.kmeans cimport cuvsKMeansType
1110
from cuvs.common.c_api cimport cuvsError_t, cuvsResources_t
1211
from cuvs.common.cydlpack cimport DLDataType, DLManagedTensor
1312

1413

14+
# Declared here rather than cimported from cuvs.cluster.kmeans.kmeans: that cimport imports the
15+
# kmeans module when this one initializes, which loops back into cuvs.common through cagra.
16+
cdef extern from "cuvs/cluster/kmeans.h" nogil:
17+
ctypedef enum cuvsKMeansType:
18+
CUVS_KMEANS_TYPE_KMEANS
19+
CUVS_KMEANS_TYPE_KMEANS_BALANCED
20+
21+
1522
cdef extern from "cuvs/preprocessing/quantize/pq.h" nogil:
1623
ctypedef struct cuvsProductQuantizerParams:
1724
uint32_t pq_bits

0 commit comments

Comments
 (0)