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

Create no GPU build for Tritonserver #1151

Merged
merged 17 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

* Remove dependency on CUDA from presets for Triton Inference Server ([pull #1151](https://github.com/bytedeco/javacpp-presets/pull/1151))
* Disable signal handlers of DepthAI known to cause issues with the JDK ([issue #1118](https://github.com/bytedeco/javacpp-presets/issues/1118))
* Upgrade presets for Gym 0.22.0, ALE 0.7.4, ONNX 1.11.0, and their dependencies

Expand Down
31 changes: 21 additions & 10 deletions tritonserver/platform/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,6 @@
</properties>

<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>cuda-platform</artifactId>
<version>11.6-8.3-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tensorrt-platform</artifactId>
<version>8.2-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${javacpp.moduleId}</artifactId>
Expand All @@ -53,6 +43,11 @@
<!-- <version>${project.version}</version>-->
<!-- <classifier>${javacpp.platform.windows-x86_64}</classifier>-->
<!-- </dependency>-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
</dependency>
</dependencies>

<build>
Expand Down Expand Up @@ -121,6 +116,22 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
22 changes: 0 additions & 22 deletions tritonserver/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,6 @@
<name>JavaCPP Presets for Triton Inference Server</name>

<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>cuda</artifactId>
<version>11.6-8.3-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tensorrt</artifactId>
<version>8.2-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>javacpp</artifactId>
Expand All @@ -45,18 +35,6 @@
<configuration>
<encoding>ISO-8859-1</encoding>
</configuration>
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>cuda</artifactId>
<version>11.6-8.3-${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tensorrt</artifactId>
<version>8.2-${project.parent.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion tritonserver/samples/SimpleCPUOnly.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected static class DeleteDeallocator extends TRITONSERVER_Server implements
System.err.println(msg);
}

System.err.println("Usage: java " + Simple.class.getSimpleName() + " [options]");
System.err.println("Usage: java " + SimpleCPUOnly.class.getSimpleName() + " [options]");
System.err.println("\t-v Enable verbose logging");
System.err.println("\t-r [model repository absolute path]");

Expand Down
41 changes: 12 additions & 29 deletions tritonserver/samples/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.bytedeco.tritonserver</groupId>
<artifactId>simple</artifactId>
<version>1.5.7</version>
<version>1.5.8-SNAPSHOT</version>
<properties>
<exec.mainClass>Simple</exec.mainClass>
<maven.compiler.source>1.8</maven.compiler.source>
Expand All @@ -11,39 +11,22 @@
<dependencies>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tritonserver-platform</artifactId>
<version>2.18-1.5.7</version>
<artifactId>cuda-platform</artifactId>
<version>11.6-8.3-1.5.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.bytedeco</groupId>
<artifactId>tensorrt-platform</artifactId>
<version>8.2-1.5.8-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.8</version>
<groupId>org.bytedeco</groupId>
<artifactId>tritonserver-platform</artifactId>
<version>2.18-1.5.8-SNAPSHOT</version>
<classifier>shaded</classifier>
</dependency>
</dependencies>
<build>
<sourceDirectory>.</sourceDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>Simple</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,29 +32,18 @@
import org.bytedeco.javacpp.tools.InfoMap;
import org.bytedeco.javacpp.tools.InfoMapper;

import org.bytedeco.cuda.presets.cudart;
import org.bytedeco.cuda.presets.cublas;
import org.bytedeco.cuda.presets.cudnn;
import org.bytedeco.cuda.presets.nvrtc;
import org.bytedeco.tensorrt.presets.nvinfer;
import org.bytedeco.tensorrt.presets.nvinfer_plugin;
import org.bytedeco.tensorrt.presets.nvonnxparser;
import org.bytedeco.tensorrt.presets.nvparsers;

/**
*
* @author Jack He
*/
@Properties(
inherit = {cublas.class, cudnn.class, nvrtc.class, nvinfer.class, nvinfer_plugin.class, nvonnxparser.class, nvparsers.class},
value = {
@Platform(
value = {"linux-arm64", "linux-ppc64le", "linux-x86_64", "windows-x86_64"},
include = {"tritonserver.h", "tritonbackend.h", "tritonrepoagent.h"},
exclude = {"<cudaGL.h>", "<cuda_gl_interop.h>"},
link = "tritonserver",
includepath = {"/opt/tritonserver/include/triton/core/", "/opt/tritonserver/include/", "/usr/local/cuda/include/", "/usr/include"},
linkpath = {"/usr/local/cuda/lib64/", "/opt/tritonserver/lib/"}
includepath = {"/opt/tritonserver/include/triton/core/", "/opt/tritonserver/include/", "/usr/include"},
linkpath = {"/opt/tritonserver/lib/"}
),
@Platform(
value = "windows-x86_64",
Expand All @@ -66,46 +55,13 @@
target = "org.bytedeco.tritonserver.tritonserver",
global = "org.bytedeco.tritonserver.global.tritonserver"
)
public class tritonserver implements LoadEnabled, InfoMapper {
public class tritonserver implements InfoMapper {
static { Loader.checkVersion("org.bytedeco", "tritonserver"); }

@Override public void init(ClassProperties properties) {
String platform = properties.getProperty("platform");
List<String> preloads = properties.get("platform.preload");
List<String> resources = properties.get("platform.preloadresource");

// Only apply this at load time since we don't want to copy the CUDA libraries here
if (!Loader.isLoadLibraries()) {
return;
}
int i = 0;
String[] libs = {"cudart", "cublasLt", "cublas", "cudnn", "nvrtc",
"cudnn_ops_infer", "cudnn_ops_train", "cudnn_adv_infer",
"cudnn_adv_train", "cudnn_cnn_infer", "cudnn_cnn_train",
"nvinfer", "nvinfer_plugin", "nvonnxparser", "nvparsers"};
for (String lib : libs) {
if (platform.startsWith("linux")) {
lib += lib.startsWith("cudnn") ? "@.8" : lib.equals("cudart") ? "@.11.0" : lib.equals("nvrtc") ? "@.11.2" : "@.11";
lib += lib.startsWith("nvinfer") ? "@.8" : lib.equals("nvonnxparser") ? "@.8" : lib.equals("nvparsers") ? "@.8" :"@.8";
} else if (platform.startsWith("windows")) {
lib += lib.startsWith("cudnn") ? "64_8" : lib.equals("cudart") ? "64_110" : lib.equals("nvrtc") ? "64_112_0" : "64_11";
lib += lib.startsWith("nvinfer") ? "64_8" : lib.equals("nvonnxparser") ? "64_8" : lib.equals("nvparsers") ? "64_8" :"64_8";
} else {
continue; // no CUDA
}
if (!preloads.contains(lib)) {
preloads.add(i++, lib);
}
}
if (i > 0) {
resources.add("/org/bytedeco/cuda/");
resources.add("/org/bytedeco/tensorrt/");
}
}

public void map(InfoMap infoMap) {
infoMap.putFirst(new Info().enumerate(false))
.put(new Info("bool").cast().valueTypes("boolean").pointerTypes("boolean[]", "BoolPointer"))
.put(new Info("const char").pointerTypes("String", "@Cast(\"const char*\") BytePointer"))
.put(new Info("std::size_t").cast().valueTypes("long").pointerTypes("LongPointer", "LongBuffer", "long[]"))
.put(new Info("TRITONSERVER_EXPORT", "TRITONSERVER_DECLSPEC",
"TRITONBACKEND_DECLSPEC", "TRITONBACKEND_ISPEC",
"TRITONREPOAGENT_DECLSPEC", "TRITONREPOAGENT_ISPEC").cppTypes().annotations())
Expand Down
2 changes: 0 additions & 2 deletions tritonserver/src/main/java9/module-info.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
module org.bytedeco.tritonserver {
requires transitive org.bytedeco.javacpp;
requires transitive org.bytedeco.cuda;
requires transitive org.bytedeco.tensorrt;
exports org.bytedeco.tritonserver.global;
exports org.bytedeco.tritonserver.presets;
exports org.bytedeco.tritonserver;
Expand Down