Skip to content

Use pre-built ONNX Runtime binaries. #276

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

Merged
merged 8 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,14 +131,16 @@ if(NOT CMAKE_BUILD_TYPE)
endif()

set(TRITON_ONNXRUNTIME_DOCKER_BUILD OFF)
# Download onnxruntime
include(cmake/download_onnxruntime.cmake)
if(TRITON_ONNXRUNTIME_LIB_PATHS STREQUAL "")
set(TRITON_ONNXRUNTIME_DOCKER_BUILD ON)
endif()

message(STATUS "Using Onnxruntime docker: ${TRITON_ONNXRUNTIME_DOCKER_BUILD}")

if(NOT TRITON_ONNXRUNTIME_DOCKER_BUILD)
find_library(ONNXRUNTIME_LIBRARY NAMES onnxruntime PATHS ${TRITON_ONNXRUNTIME_LIB_PATHS})
find_library(ONNXRUNTIME_LIBRARY NAMES onnxruntime PATHS ${TRITON_ONNXRUNTIME_LIB_PATHS} REQUIRED)
if(${TRITON_ENABLE_ONNXRUNTIME_OPENVINO})
find_library(OV_LIBRARY
NAMES openvino
Expand Down
25 changes: 25 additions & 0 deletions cmake/download_onnxruntime.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
if(DEFINED TRITON_ONNXRUNTIME_PACKAGE_URL)

set(DOWNLOAD_PATH "${CMAKE_BINARY_DIR}/_deps/downloads/onnxruntime.zip")
set(EXTRACT_DIR "${CMAKE_BINARY_DIR}/_deps/downloads/onnxruntime")

message(NOTICE "Downloading onnxruntime: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")

file(DOWNLOAD ${TRITON_ONNXRUNTIME_PACKAGE_URL} ${DOWNLOAD_PATH} SHOW_PROGRESS STATUS DOWNLOAD_STATUS)

# file(DOWNLOAD ... STATUS DOWNLOAD_STATUS) returns a list with 2 elements
list(GET DOWNLOAD_STATUS 0 DOWNLOAD_RESULT)

if(NOT DOWNLOAD_RESULT EQUAL 0)
message(NOTICE "Failed to download: ${TRITON_ONNXRUNTIME_PACKAGE_URL}")
else()
message(NOTICE "Download successful: ${DOWNLOAD_PATH}" )

file(ARCHIVE_EXTRACT INPUT ${DOWNLOAD_PATH} DESTINATION ${EXTRACT_DIR} VERBOSE )

set(TRITON_ONNXRUNTIME_INCLUDE_PATHS ${EXTRACT_DIR}/include)
set(TRITON_ONNXRUNTIME_LIB_PATHS ${EXTRACT_DIR}/lib)

endif(NOT DOWNLOAD_RESULT EQUAL 0)

endif(DEFINED TRITON_ONNXRUNTIME_PACKAGE_URL)
Loading