-
Notifications
You must be signed in to change notification settings - Fork 75
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
base: branch-25.02
Are you sure you want to change the base?
Changes from 19 commits
c777924
f9c2df7
1597158
6f405e9
8531be2
c9b8891
9bb865a
d40b3d0
1e03585
3222536
c5536b6
2d79580
84c6121
20562ee
ad11369
6a851ef
68e8b94
3852f6e
479e488
43f5e15
3438dbf
4411629
b7da0ef
c4346d9
cefadb8
8492c72
8e7c62c
eb94a0f
d32f8f9
bbcbba1
696f015
b95bb7f
9ab2754
638092c
51eb397
fb295dd
80174d2
61ea9ac
1803dee
7cda1e5
53dfa23
6f708eb
b98d2bb
81b60f1
dca835d
e3757c0
0aa2665
a89fe5d
b44baa9
98c3c93
feed385
1d80b41
2f0f143
2c0e4cd
72bc6e3
b79a17e
6819bdf
bc280e4
392d0ff
a0dba4a
bfd355b
ab1c53f
a197d52
69ef479
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,12 @@ | ||
Prerequisites | ||
------------- | ||
|
||
* 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. | ||
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. As per comment above, I think we should mention this, but also mention that calling 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. Updated. |
||
|
||
Building | ||
-------- | ||
|
||
`./build.sh` will generate the libcuvs_java.so file in internal/ directory, and then build the final jar file for the cuVS Java API in cuvs-java/ directory. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export CMAKE_PREFIX_PATH=`pwd`/../cpp/build | ||
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. Can we put this logic in the top-level build.sh please? We do that with all of the other language support. 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. Fixed. |
||
cd internal && cmake . && cmake --build . \ | ||
&& cd .. \ | ||
&& mvn install:install-file -DgroupId=com.nvidia.cuvs -DartifactId=cuvs-java-internal -Dversion=24.12 -Dpackaging=so -Dfile=./internal/libcuvs_java.so \ | ||
&& cd cuvs-java \ | ||
&& mvn package \ | ||
&& mvn install:install-file -Dfile=./target/cuvs-java-24.12.1-jar-with-dependencies.jar -DgroupId=com.nvidia.cuvs -DartifactId=cuvs-java -Dversion=24.12.1 -Dpackaging=jar |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
<!-- | ||
/* | ||
* Copyright (c) 2024, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>com.nvidia.cuvs</groupId> | ||
<artifactId>cuvs-java</artifactId> | ||
<version>24.12.1</version> | ||
<name>cuvs-java</name> | ||
<packaging>jar</packaging> | ||
|
||
<properties> | ||
<maven.compiler.target>22</maven.compiler.target> | ||
<maven.compiler.source>22</maven.compiler.source> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>commons-io</groupId> | ||
<artifactId>commons-io</artifactId> | ||
<version>2.15.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>com.github.fommil</groupId> | ||
<artifactId>jniloader</artifactId> | ||
<version>1.1</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>2.0.13</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<version>2.0.13</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.junit.jupiter</groupId> | ||
<artifactId>junit-jupiter-api</artifactId> | ||
<version>5.10.0</version> | ||
</dependency> | ||
|
||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>2.7</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.library.path>${project.build.directory}/classes</java.library.path> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-dependency-plugin</artifactId> | ||
<version>2.10</version> | ||
<executions> | ||
<execution> | ||
<id>copy</id> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>copy</goal> | ||
</goals> | ||
<configuration> | ||
<artifactItems> | ||
<artifactItem> | ||
<groupId>com.nvidia.cuvs</groupId> | ||
<artifactId>cuvs-java-internal</artifactId> | ||
<version>24.12</version> | ||
<type>so</type> | ||
<overWrite>false</overWrite> | ||
<outputDirectory> | ||
${project.build.directory}/classes</outputDirectory> | ||
<destFileName>libcuvs_java.so</destFileName> | ||
</artifactItem> | ||
</artifactItems> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<version>3.4.2</version> | ||
<configuration> | ||
<descriptorRefs> | ||
<descriptorRef>jar-with-dependencies</descriptorRef> | ||
</descriptorRefs> | ||
<archiverConfig> | ||
<duplicateBehavior>add</duplicateBehavior> | ||
</archiverConfig> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>assemble-all</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>2.2</version> | ||
<configuration> | ||
<archive> | ||
<manifest> | ||
<addClasspath>true</addClasspath> | ||
<mainClass> | ||
com.nvidia.cuvs.examples.CagraExample</mainClass> | ||
</manifest> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-javadoc-plugin</artifactId> | ||
<version>3.6.2</version> | ||
<configuration> | ||
<excludePackageNames>com.nvidia.cuvs.examples,com.nvidia.cuvs.panama</excludePackageNames> | ||
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
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.
Please don't check .gitignore into .gitignore. We need to know when this file changes.
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.
Fixed.