Skip to content
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

Initial cut for a cuVS Java API #450

Open
wants to merge 19 commits into
base: branch-24.12
Choose a base branch
from

Conversation

chatman
Copy link

@chatman chatman commented Nov 8, 2024

A Java API for cuVS for easy integration into Apache Lucene or other Java based projects.

Try:

./build.sh libcuvs
./build.sh java

For generating docs, mvn javadoc:javadoc

Prerequisites:

  • JDK 22
  • Maven 3.9.6+

Todo:

  • Generate project panama classes using jextract on every build
  • Algorithms other than Cagra
  • Prefiltering in cagra

Co-authored-by: Vivek Narang <[email protected]>
@chatman chatman requested review from a team as code owners November 8, 2024 14:05
@chatman chatman requested a review from msarahan November 8, 2024 14:05
Copy link

copy-pr-bot bot commented Nov 8, 2024

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@github-actions github-actions bot added the CMake label Nov 8, 2024
@chatman
Copy link
Author

chatman commented Nov 8, 2024

FYI @cjnolet ^
An ExampleApp.java is added as a starting point for the review.

@cjnolet cjnolet added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Nov 8, 2024
@cjnolet cjnolet changed the base branch from branch-24.10 to branch-24.12 November 8, 2024 16:06
@cjnolet
Copy link
Member

cjnolet commented Nov 8, 2024

/ok to test

@chatman chatman changed the title [WIP] Initial cut for a cuVS Java API Initial cut for a cuVS Java API Nov 18, 2024
@chatman
Copy link
Author

chatman commented Nov 18, 2024

@naramgvivek10 Let's move CuVSResources to the cuvs package instead of common? That way we can abstract out the internals of Panama out of sight of the users.

@cjnolet
Copy link
Member

cjnolet commented Nov 18, 2024

/ok to test

@@ -459,6 +461,12 @@ if (( ${NUMARGS} == 0 )) || hasArg rust; then
cargo test
fi

# Build the cuvs Java bindings
if (( ${NUMARGS} == 0 )) || hasArg java; then
cd ${REPODIR}/java
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should make this smart enough to automatically build libcuvs when the java arg is supplied. Just makes the overall experience better for users when they don't need to know all the ins and outs of the build in order to get a build from source.

* JDK 22
* Maven 3.9.6 or later

Please build libcuvs (`./build.sh libcuvs` from top level directory) before building the Java API with `./build.sh` from this directory.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per comment above, I think we should mention this, but also mention that calling build.sh java from the top level will automatically build libcuvs.

<manifest>
<addClasspath>true</addClasspath>
<mainClass>
com.nvidia.cuvs.ExampleApp</mainClass>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have establiahed a convention of putting example apps in the examples subdirectory under the top-level repository. Can we please do that with Java as well? In additon to just showing how to use the APIs, those examples also demonstrate how a user would build and include cuvs artifacts in their applications.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

@@ -0,0 +1,352 @@
/*
* Copyright (c) 2023-2024, NVIDIA CORPORATION.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All new files should only include the current year.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CMake improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants