Skip to content

Commit

Permalink
[serving] Fixes nightly benchmark for onnx GPU (#1812)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankfliu authored Apr 24, 2024
1 parent 63dccff commit f4c0482
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion serving/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ dependencies {
runtimeOnly "ai.djl:model-zoo"
runtimeOnly "ai.djl.tensorflow:tensorflow-model-zoo"
runtimeOnly "ai.djl.pytorch:pytorch-model-zoo"
runtimeOnly "ai.djl.onnxruntime:onnxruntime-engine"
runtimeOnly "ai.djl.huggingface:tokenizers"
runtimeOnly "ai.djl.tensorrt:tensorrt"
if (JavaVersion.current() >= JavaVersion.VERSION_15) {
Expand All @@ -31,6 +30,23 @@ dependencies {
}
runtimeOnly project(":engines:python")

ProcessBuilder pb = new ProcessBuilder("nvidia-smi", "-L")
def hasGPU = false;
try {
Process process = pb.start()
hasGPU = process.waitFor() == 0
} catch (IOException ignore) {
}

if (hasGPU) {
runtimeOnly("ai.djl.onnxruntime:onnxruntime-engine") {
exclude group: "com.microsoft.onnxruntime", module: "onnxruntime"
}
runtimeOnly "com.microsoft.onnxruntime:onnxruntime_gpu:${onnxruntime_version}"
} else {
runtimeOnly "ai.djl.onnxruntime:onnxruntime-engine"
}

testRuntimeOnly "org.yaml:snakeyaml:${snakeyaml_version}"
testImplementation("org.testng:testng:${testng_version}") {
exclude group: "junit", module: "junit"
Expand Down

0 comments on commit f4c0482

Please sign in to comment.