-
Notifications
You must be signed in to change notification settings - Fork 111
[CuVS-Java] Automate panama bindings generation, Include IVF_PQ parameters in CAGRA index parameters and other changes #831
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 22 commits
1cd8d67
48f878f
9a8c606
83d1ae2
4dcda3c
5a388c7
07e16d0
fcef00b
4327f63
b23aa36
271dee5
cc745b7
20063eb
d347610
6021c09
df1f6f2
064760d
37cc0d4
02cc69f
53fddbb
806af86
050defc
b516348
570fa2a
6dfef85
306229d
73db62a
5bf8961
24f127a
f19f3d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# cuvs-java | ||
/cuvs-java/target/ | ||
/cuvs-java/bin/ | ||
/cuvs-java/src/main/java22/com/nvidia/cuvs/internal/panama/ | ||
/cuvs-java/*.cag | ||
# internal | ||
/internal/.ninja_deps | ||
/internal/.ninja_log | ||
/internal/CMakeCache.txt | ||
/internal/CMakeFiles/ | ||
/internal/CPM_modules/ | ||
/internal/_deps/ | ||
/internal/build.ninja | ||
/internal/cmake/ | ||
/internal/cmake_install.cmake | ||
/internal/cpm-package-lock.cmake | ||
/internal/Makefile | ||
# examples | ||
/examples/target/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,26 @@ | ||
Prerequisites | ||
------------- | ||
# CuVS Java API | ||
|
||
* JDK 22 | ||
* Maven 3.9.6 or later | ||
|
||
To build this API, please do `./build.sh java` in the top level directory. Since this API is dependent on `libcuvs` it must be noted that `libcuvs` gets built automatically before building this API. | ||
CuVS Java API provides a Java based simple, efficient, and a robust vector search API. | ||
|
||
Alternatively, please build libcuvs (`./build.sh libcuvs` from top level directory) before building the Java API with `./build.sh` from this directory. | ||
> [!CAUTION] | ||
> CuVS 25.06 contains an experimental version and updates to this API are expected in the coming release. | ||
|
||
Building | ||
-------- | ||
## Prerequisites | ||
|
||
`./build.sh` will generate the `libcuvs_java.so` file in the `internal/` directory, and then build the final jar file for the cuVS Java API in the `cuvs-java/` directory. | ||
- [CuVS libraries](https://docs.rapids.ai/api/cuvs/stable/build/#build-from-source) | ||
- [maven 3.9.6 or above](https://maven.apache.org/download.cgi) | ||
- [JDK 22](https://openjdk.org/projects/jdk/22/) | ||
|
||
|
||
## Building | ||
|
||
The libcuvs C and C++ libraries are needed for this API. If libcuvs libraries have not been built and installed, use `./build.sh libcuvs java` in the top level directory to build this API. | ||
|
||
Alternatively, if libcuvs libraries are already built and you just want to build this API, please | ||
do `./build.sh java` in the top level directory or just do `./build.sh` in this directory. | ||
|
||
|
||
## Examples | ||
|
||
A few starter examples of CAGRA, HNSW, and Bruteforce index are provided in the `examples` directory. |
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -6,6 +6,17 @@ if [ -z "$CMAKE_PREFIX_PATH" ]; then | |||||||||||||||
export CMAKE_PREFIX_PATH=`pwd`/../cpp/build | ||||||||||||||||
fi | ||||||||||||||||
|
||||||||||||||||
# Generate Panama FFM API bindings and update (if any of them changed) | ||||||||||||||||
/bin/bash panama-bindings/generate-bindings.sh | ||||||||||||||||
|
||||||||||||||||
BINDINGS_GENERATION_RETURN_VALUE=$? | ||||||||||||||||
if [ $BINDINGS_GENERATION_RETURN_VALUE != 0 ] | ||||||||||||||||
then | ||||||||||||||||
echo "Bindings generation did not complete normally (returned value ${BINDINGS_GENERATION_RETURN_VALUE})" | ||||||||||||||||
echo "Forcing this build process to abort" | ||||||||||||||||
exit 1 | ||||||||||||||||
fi | ||||||||||||||||
|
||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Instead of having this custom return-code handling, would you please consider:
That's simplify the code here a bit. |
||||||||||||||||
cd internal && cmake . && cmake --build . \ | ||||||||||||||||
&& cd .. \ | ||||||||||||||||
&& mvn install:install-file -DgroupId=$GROUP_ID -DartifactId=cuvs-java-internal -Dversion=$VERSION -Dpackaging=so -Dfile=$SO_FILE_PATH/libcuvs_java.so \ | ||||||||||||||||
|
This file was deleted.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -40,7 +40,7 @@ public class BruteForceQuery { | |||||
* @param queryVectors 2D float query vector array | ||||||
* @param mapping an instance of ID mapping | ||||||
* @param topK the top k results to return | ||||||
* @param prefilter the prefilter data to use while searching the BRUTEFORCE | ||||||
* @param prefilters the prefilters data to use while searching the BRUTEFORCE | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Let's keep this aligned with all the other lines above it, please. |
||||||
* index | ||||||
* @param numDocs Maximum of bits in each prefilter, representing number of documents in this index. | ||||||
* Used only when prefilter(s) is/are passed. | ||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
panama-binding/generate-bindings.sh
already has/bin/bash
in its shebang... let's please not duplicate that here.If you haven't already, this change should be accompanied with making
generate-bindings.sh
executable.