Skip to content

Commit

Permalink
Merge branch 'main' of github.com:microsoft/onnxruntime into wangye/m…
Browse files Browse the repository at this point in the history
…oe_q
  • Loading branch information
wangyems committed Mar 22, 2024
2 parents 379dffa + f9cddd2 commit be8a936
Show file tree
Hide file tree
Showing 60 changed files with 1,734 additions and 1,150 deletions.
37 changes: 9 additions & 28 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1290,34 +1290,6 @@ if (onnxruntime_USE_OPENVINO)

add_definitions(-DUSE_OPENVINO=1)

if (EXISTS "$ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/version.txt")
file(READ $ENV{INTEL_OPENVINO_DIR}/deployment_tools/inference_engine/version.txt VER)
endif()

if (NOT DEFINED ENV{INTEL_OPENVINO_DIR})
message(FATAL_ERROR "[Couldn't locate OpenVINO] OpenVINO may not have been initialized")
endif()

# Check OpenVINO version for support
if ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.0")
set(OPENVINO_VERSION "2023.0")
add_definitions(-DOPENVINO_2023_0=1)
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.1")
set(OPENVINO_VERSION "2023.1")
add_definitions(-DOPENVINO_2023_1=1)
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.2")
set(OPENVINO_VERSION "2023.2")
add_definitions(-DOPENVINO_2023_2=1)
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "2023.3")
set(OPENVINO_VERSION "2023.3")
add_definitions(-DOPENVINO_2023_3=1)
elseif ($ENV{INTEL_OPENVINO_DIR} MATCHES "openvino")
set(OPENVINO_VERSION "2023.3")
add_definitions(-DOPENVINO_2023_3=1)
else()
message(FATAL_ERROR "Unsupported OpenVINO version: ${INTEL_OPENVINO_DIR}")
endif()

if (onnxruntime_USE_OPENVINO_GPU_FP32)
add_definitions(-DOPENVINO_CONFIG_GPU_FP32=1)
endif()
Expand All @@ -1334,6 +1306,10 @@ if (onnxruntime_USE_OPENVINO)
add_definitions(-DOPENVINO_CONFIG_CPU_FP16=1)
endif()

if (onnxruntime_USE_OPENVINO_NPU)
add_definitions(-DOPENVINO_CONFIG_NPU=1)
endif()

if (onnxruntime_USE_OPENVINO_GPU_FP32_NP)
add_definitions(-DOPENVINO_CONFIG_GPU_FP32=1)
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
Expand All @@ -1354,6 +1330,11 @@ if (onnxruntime_USE_OPENVINO)
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
endif()

if (onnxruntime_USE_OPENVINO_NPU_NP)
add_definitions(-DOPENVINO_CONFIG_NPU=1)
add_definitions(-DOPENVINO_DISABLE_GRAPH_PARTITION=1)
endif()

if (onnxruntime_USE_OPENVINO_HETERO)
add_definitions(-DOPENVINO_CONFIG_HETERO=1)
add_definitions(-DDEVICE_NAME="${onnxruntime_USE_OPENVINO_DEVICE}")
Expand Down
10 changes: 10 additions & 0 deletions cmake/external/onnxruntime_external_deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ foreach(ONNXRUNTIME_DEP IN LISTS ONNXRUNTIME_DEPS_LIST)
set(DEP_URL_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP_URL})
# The third column is SHA1 hash value
set(DEP_SHA1_${ONNXRUNTIME_DEP_NAME} ${ONNXRUNTIME_DEP})

if(ONNXRUNTIME_DEP_URL MATCHES "^https://")
# Search a local mirror folder
string(REGEX REPLACE "^https://" "${REPO_ROOT}/mirror/" LOCAL_URL "${ONNXRUNTIME_DEP_URL}")

if(EXISTS "${LOCAL_URL}")
cmake_path(ABSOLUTE_PATH LOCAL_URL)
set(DEP_URL_${ONNXRUNTIME_DEP_NAME} "${LOCAL_URL}")
endif()
endif()
endif()
endforeach()

Expand Down
27 changes: 15 additions & 12 deletions cmake/onnxruntime_providers_openvino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,19 @@
endif()

# Header paths
find_package(InferenceEngine REQUIRED)
find_package(ngraph REQUIRED)

if (OPENVINO_2022_1 OR OPENVINO_2022_2)
find_package(OpenVINO REQUIRED COMPONENTS Runtime ONNX)
list (OV_20_LIBS openvino::frontend::onnx openvino::runtime)
if(OpenVINO_VERSION VERSION_LESS 2023.0)
message(FATAL_ERROR "OpenVINO 2023.0 and newer are supported. Please, latest OpenVINO release")
endif()

if (WIN32)
unset(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO)
endif()

list(APPEND OPENVINO_LIB_LIST openvino::frontend::onnx openvino::runtime ${PYTHON_LIBRARIES})
if ((DEFINED ENV{OPENCL_LIBS}) AND (DEFINED ENV{OPENCL_INCS}))
add_definitions(-DIO_BUFFER_ENABLED=1)
list(APPEND OPENVINO_LIB_LIST $ENV{OPENCL_LIBS} ${OV_20_LIBS} ${InferenceEngine_LIBRARIES} ${NGRAPH_LIBRARIES} ngraph::onnx_importer ${PYTHON_LIBRARIES})
else()
list(APPEND OPENVINO_LIB_LIST ${OV_20_LIBS} ${InferenceEngine_LIBRARIES} ${NGRAPH_LIBRARIES} ngraph::onnx_importer ${PYTHON_LIBRARIES})
list(APPEND OPENVINO_LIB_LIST $ENV{OPENCL_LIBS})
endif()

source_group(TREE ${ONNXRUNTIME_ROOT}/core FILES ${onnxruntime_providers_openvino_cc_srcs})
Expand Down Expand Up @@ -75,7 +71,14 @@
message(FATAL_ERROR "onnxruntime_providers_openvino unknown platform, need to specify shared library exports for it")
endif()

install(TARGETS onnxruntime_providers_openvino
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (CMAKE_OPENVINO_LIBRARY_INSTALL_DIR)
install(TARGETS onnxruntime_providers_openvino
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_OPENVINO_LIBRARY_INSTALL_DIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
else()
install(TARGETS onnxruntime_providers_openvino
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
6 changes: 3 additions & 3 deletions dockerfiles/Dockerfile.openvino
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#-------------------------------------------------------------------------
# Copyright(C) 2021-2023 Intel Corporation.
# Copyright(C) 2021-2024 Intel Corporation.
# SPDX-License-Identifier: MIT
#--------------------------------------------------------------------------

ARG OPENVINO_VERSION=2023.0.0
ARG OPENVINO_VERSION=2024.0.0


# Build stage
Expand All @@ -17,7 +17,7 @@ ARG DEVICE=CPU_FP32
ARG ONNXRUNTIME_REPO=https://github.com/microsoft/onnxruntime.git
ARG ONNXRUNTIME_BRANCH=main

ENV InferenceEngine_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake
ENV OpenVINO_DIR=${INTEL_OPENVINO_DIR}/runtime/cmake

USER root
RUN apt update; apt install -y git protobuf-compiler libprotobuf-dev
Expand Down
105 changes: 0 additions & 105 deletions dockerfiles/Dockerfile.openvino-centos7

This file was deleted.

90 changes: 0 additions & 90 deletions dockerfiles/Dockerfile.openvino-csharp

This file was deleted.

Loading

0 comments on commit be8a936

Please sign in to comment.