forked from bytedeco/javacpp-presets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add presets for Triton Inference Server 2.14 (pull bytedeco#1085)
Co-authored-by: jackhe <[email protected]> Co-authored-by: Samuel Audet <[email protected]>
- Loading branch information
1 parent
eaf4ed4
commit 9a07755
Showing
43 changed files
with
7,139 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: tritonserver | ||
on: | ||
push: | ||
paths: | ||
- tritonserver/** | ||
pull_request: | ||
paths: | ||
- tritonserver/** | ||
workflow_dispatch: | ||
env: | ||
CI_DEPLOY_MODULE: ${{ github.workflow }} | ||
CI_DEPLOY_PLATFORM: ${{ github.job }} | ||
CI_DEPLOY_SETTINGS: ${{ secrets.CI_DEPLOY_SETTINGS }} | ||
CI_DEPLOY_USERNAME: ${{ secrets.CI_DEPLOY_USERNAME }} | ||
CI_DEPLOY_PASSWORD: ${{ secrets.CI_DEPLOY_PASSWORD }} | ||
STAGING_REPOSITORY: ${{ secrets.STAGING_REPOSITORY }} | ||
jobs: | ||
linux-x86_64: | ||
runs-on: ubuntu-18.04 | ||
container: nvcr.io/nvidia/tritonserver:21.09-py3 | ||
steps: | ||
- uses: bytedeco/javacpp-presets/.github/actions/deploy-ubuntu@actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
JavaCPP Presets for Triton Inference Server | ||
=========================================== | ||
|
||
[](https://gitter.im/bytedeco/javacpp) [](https://maven-badges.herokuapp.com/maven-central/org.bytedeco/tritonserver) [](http://bytedeco.org/builds/) | ||
<sup>Build status for all platforms:</sup> [](https://github.com/bytedeco/javacpp-presets/actions?query=workflow%3Atritonserver) <sup>Commercial support:</sup> [](https://xscode.com/bytedeco/javacpp-presets) | ||
|
||
|
||
License Agreements | ||
------------------ | ||
By downloading these archives, you agree to the terms of the license agreements for NVIDIA software included in the archives. | ||
|
||
### Triton Inference Server | ||
To view the license for Triton Inference Server included in these archives, click [here](https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license) | ||
|
||
* Triton Inference Server is widely used software package for inference service | ||
* Triton supports almost all kinds of model generated by different DL frameworks or tools, such as TensorFlow, PyTorch, ONNX Runtime, TensorRT, OpenVINO... | ||
* Triton supports both CPU and GPU | ||
* Triton can be used both as an application and as a shared library. In case you already have your own inference service framework but want to add more features, just try Triton as a shared library. | ||
* Triton supports Java as a shared library through JavaCPP Presets | ||
|
||
|
||
Introduction | ||
------------ | ||
This directory contains the JavaCPP Presets module for: | ||
|
||
* Triton Inference Server 2.14 https://github.com/triton-inference-server/server | ||
|
||
Please refer to the parent README.md file for more detailed information about the JavaCPP Presets. | ||
|
||
|
||
Documentation | ||
------------- | ||
Java API documentation is available here: | ||
|
||
* http://bytedeco.org/javacpp-presets/tritonserver/apidocs/ | ||
|
||
|
||
Sample Usage | ||
------------ | ||
Here is a simple example of Triton Inference Server ported to Java from the `simple.cc` sample file available at: | ||
|
||
* https://github.com/triton-inference-server/server/tree/main/src/servers | ||
|
||
We can use [Maven 3](http://maven.apache.org/) to download and install automatically all the class files as well as the native binaries. To run this sample code, after creating the `pom.xml` and `Simple.java` source files from the [`samples/`](samples/) subdirectory, simply execute on the command line: | ||
```bash | ||
$ mvn compile exec:java -Dexec.args="-r /path/to/models" | ||
``` | ||
This sample intends to show how to call the Java-mapped C API of Triton to execute inference requests. | ||
|
||
### Steps to run this sample inside an NGC container | ||
|
||
1. Get the source code of Triton Inference Server to prepare the model repository: | ||
```bash | ||
$ wget https://github.com/triton-inference-server/server/archive/refs/tags/v2.14.0.tar.gz | ||
$ tar zxvf v2.14.0.tar.gz | ||
$ cd server-2.14.0/docs/examples/model_repository | ||
$ mkdir models | ||
$ cd models; cp -a ../simple . | ||
``` | ||
Now, this `models` directory will be our model repository. | ||
|
||
2. Start the Docker container to run the sample (assuming we are under the `models` directory created above): | ||
```bash | ||
$ docker run -it --gpus=all -v $(pwd):/workspace nvcr.io/nvidia/tritonserver:21.09-py3 bash | ||
$ apt update | ||
$ apt install -y openjdk-11-jdk | ||
$ wget https://dlcdn.apache.org/maven/maven-3/3.8.3/binaries/apache-maven-3.8.3-bin.tar.gz | ||
$ tar zxvf apache-maven-3.8.3-bin.tar.gz | ||
$ export PATH=/opt/tritonserver/apache-maven-3.8.2/bin:$PATH | ||
$ git clone https://github.com/bytedeco/javacpp-presets.git | ||
$ cd javacpp-presets/tritonserver/samples | ||
$ mvn compile exec:java -Djavacpp.platform=linux-x86_64 -Dexec.args="-r /workspace/models" | ||
``` | ||
|
||
This sample is the Java implementation of the simple example written for the [C API](https://github.com/triton-inference-server/server/blob/main/docs/inference_protocols.md#c-api). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/bash | ||
# This file is meant to be included by the parent cppbuild.sh script | ||
if [[ -z "$PLATFORM" ]]; then | ||
pushd .. | ||
bash cppbuild.sh "$@" tritonserver | ||
popd | ||
exit | ||
fi | ||
|
||
case $PLATFORM in | ||
linux-arm64) | ||
if [[ ! -f "/opt/tritonserver/include/triton/core/tritonserver.h" ]] && [[ ! -d "/opt/tritonserver/lib/" ]]; then | ||
echo "Please make sure library and include files exist" | ||
exit 1 | ||
fi | ||
;; | ||
linux-x86_64) | ||
if [[ ! -f "/opt/tritonserver/include/triton/core/tritonserver.h" ]] && [[ ! -d "/opt/tritonserver/lib/" ]]; then | ||
echo "Please make sure library and include files exist" | ||
exit 1 | ||
fi | ||
;; | ||
windows-x86_64) | ||
echo "Windows is not supported yet" | ||
exit 1 | ||
;; | ||
*) | ||
echo "Error: Platform \"$PLATFORM\" is not supported" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>javacpp-presets</artifactId> | ||
<version>1.5.7-SNAPSHOT</version> | ||
<relativePath>../../</relativePath> | ||
</parent> | ||
|
||
<groupId>org.bytedeco</groupId> | ||
<artifactId>tritonserver-platform</artifactId> | ||
<version>2.14-${project.parent.version}</version> | ||
<name>JavaCPP Presets Platform for Tritonserver</name> | ||
|
||
<properties> | ||
<javacpp.moduleId>tritonserver</javacpp.moduleId> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>cuda-platform</artifactId> | ||
<version>11.4-8.2-${project.parent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.bytedeco</groupId> | ||
<artifactId>tensorrt-platform</artifactId> | ||
<version>8.0-${project.parent.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>${javacpp.moduleId}</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>${javacpp.moduleId}</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>${javacpp.platform.linux-arm64}</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>${javacpp.moduleId}</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>${javacpp.platform.linux-x86_64}</classifier> | ||
</dependency> | ||
<dependency> | ||
<groupId>${project.groupId}</groupId> | ||
<artifactId>${javacpp.moduleId}</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>${javacpp.platform.windows-x86_64}</classifier> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-jar</id> | ||
<configuration> | ||
<archive> | ||
<manifestEntries> | ||
<Class-Path>${javacpp.moduleId}.jar ${javacpp.moduleId}-linux-arm64.jar ${javacpp.moduleId}-linux-x86_64.jar ${javacpp.moduleId}-windows-x86_64.jar</Class-Path> | ||
</manifestEntries> | ||
</archive> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>empty-javadoc-jar</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<configuration> | ||
<classifier>javadoc</classifier> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>empty-sources-jar</id> | ||
<goals> | ||
<goal>jar</goal> | ||
</goals> | ||
<configuration> | ||
<classifier>sources</classifier> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.moditect</groupId> | ||
<artifactId>moditect-maven-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>add-module-infos</id> | ||
<phase>none</phase> | ||
</execution> | ||
<execution> | ||
<id>add-platform-module-info</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>add-module-info</goal> | ||
</goals> | ||
<configuration> | ||
<modules> | ||
<module> | ||
<file>${project.build.directory}/${project.artifactId}.jar</file> | ||
<moduleInfoSource> | ||
module org.bytedeco.${javacpp.moduleId}.platform { | ||
requires static org.bytedeco.${javacpp.moduleId}.linux.arm64; | ||
requires static org.bytedeco.${javacpp.moduleId}.linux.x86_64; | ||
requires static org.bytedeco.${javacpp.moduleId}.windows.x86_64; | ||
} | ||
</moduleInfoSource> | ||
</module> | ||
</modules> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
Oops, something went wrong.