mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-21 19:18:55 +00:00
* Initial commit for OpenVINO Execution Provider OpenVINO Execution Provider provides the interface for ONNX Runtime applications to access Intel's hardware accelerators using Intel's OpenVINO Toolkit. * Fixed bug in GetCapability to disable custom ops Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Added OPENVINO ci pipeline Added new pipeline for openvino provider, made changes to support the docker build and onnxruntime build with openvino. Signed-off-by: Luis Daniel Castellanos <luis.daniel.castellanos@intel.com> * Enabled all unit tests for OpenVINO EP Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Fixed syntax issue in run_docker_build.sh file * Added missing default OPENVINO_VERSION Default value for OPENVINO_VERSION env was missing causing the build to fail * Added install Model Optimizer deps step * Fixed python unit tests and some tests from onnx_backend_test_series Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Fixed indentation bug Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled some of the python backend tests for OpenVINO Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled some model tests Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Remove Duplicate checks for openvino in build.py Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Modified GetCapability for FP16 Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled GPU FP32 tests that are not supported Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Convert modelProto to string and use it in compile Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Pass byte-array input args to MO * Serialized ModelProto passed in-memory to MO ModelOptimizer python module receives the serialized ModelProto in-memory. Uses appropriate ONNX function to load the serialized bytes. * Make Py_Finalize compatible with older python versions Also, remove pFunc unassigned variable possibility. * Fallback if input dims of Matmul is greater than 2 Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * fixup: Device #define syntax * Updated the documentation Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Enable dynamic dim value * removed commented out code * Added Dockerfile for openvino EP Updated instructions on dockerfiles/README.md file Signed-off-by: Luis Daniel Castellanos <luis.daniel.castellanos@intel.com> * Disabled fp16_inception_v1 test Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Code formatting with clang-format Uses style from the .clang-format file in root directory. * fixup: docker tag and build error fixes * Heuristics to automatically detect batching Distributes slices from batch into parallel infer-request objects. * Handle disabled tests in GetCapability Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled average pool and max pool if ceil_mode is 1 Also dilations are not supported if they are greater than 1 Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled Unsqueeze int32 test Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * changes to fix output results bug * Disabled a few C++ unit tests for MYRIAD FP16 Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Manually revert '9fe162bb Enable dynamic dim value' Reverts compile time setting of dynamic shape Reverting manually due to significantly huge auto-revert conflicts. * Fixed unused variable warning Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled Mul test for GPU_FP16 due to accuracy issue Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * VPU documentation update * Disabled inception_v1 for MYRIAD and HDDL *Also disabled few C++ accuracy tests for HDDL Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * updates from upstream * use the new CustomOpApis for I/O interfacing * Pass initializers as subgraph meta-def inputs in GetCapability() Requirement due to API changes introduced with PR# 1019. * Remove obsolete functions * Save indexes of graph inputs from fused_node info Both inputs and initializers are passed as data inputs to the infer function. To identify only inputs among them, save thier index info from fused_node in Compile function. * Documentation changes to enable VPU * Fix VPU related changes in documentation * Fix minor changes in documentation * Fix VPU related changes in documentation * Use Node.In/OutputDefs() to track graph inputs and outputs. Don't use graph_viewer's GetInputs() or GetInputsIncludingInitializers(). * Permit "SAME_UPPER" auto_pad attribute from MaxPool * Disabled fp16_tiny_yolov2 in onnx model tests * Updated documentation to include configuration guides for myriad and hddl Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Use 8 Infer requests only for VAD-R * disable debug prints * Clang-format source files * Updated BUILD.md with OpenVINO R5 links Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled same upper python tests Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Update test exclusion syntax * Change path of install_onnx.sh Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disable tiny_yolov2 in broken tests Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Revert "Change path of install_onnx.sh" This reverts commit ba9db165f3be430f2aff1ef413299ed04637196a. This change is only required for Intel internal CI pipeline until the settings are matched with the upstream's CI pipeline. * Added debug statements for debugging CI error Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Add --build_wheel to linux openvino pipeline Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Added -v option to onnx_test_runner for debugging Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Removed path change patch Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Added -c 1 to onnx_test_runner Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Refactor MO python invocation in separate function Cleans up Model Optimizer python invocation check and conversion logic. Invokes MO only once in GetCapability() and passes the IR strings (xml and bin) to the Compiler as meta-def attributes. * Add comments * code cleanup and comments * Code cleanup for GetCapability Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Removed unnecessary files Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Revert "Added -v option to onnx_test_runner for debugging" This reverts commit d1dd70938a94d648df1a1dbbc2e48d0b97e49ec8. * Revert "Added debug statements for debugging CI error" This reverts commit b86d41afed2aa29c3508155d6f9c8d3a7263cc60. * incorporate Status Code changes * ComputeFunc returns Status::OK() on success * Use test names to disable tests for MYRIAD and VAD-R Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Rename local identifiers from CNNNetwork to OpenVINO network CNNNetwork is an OpenVINO's API class that represents more than just convolutional neural networks (CNNs). Renaming helps to avoid confusion that the API's only support CNN type models. * Added error message if building on windows * Removed duplicate option in Cmake * Removed unnecessary parameters in activation_opt_test Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Refactor Map search and access logic for efficiently and cleanliness. * use C++ style casts * Use os.path.join for python directory path operations * use C++ style casts * EP classes should use onnxruntime namespace * Clean up fixes from PR comments * Don't explicitly shutdown Py interpreter * Remove debug print statements Prints will be re-enabled later with a logging mechanism with debug/verbose printing options. * Decrement ref counts for used pyObjects * Restore build instructions for other compilers Content under the "Using other compilers" section has been accidentally deleted by a previous commit. Restoring back that content from the latest upstream repo. * CMake code cleanup Code clean up, commenting and formatting of CMake code. * Don't pass the unused device_info parameter to OpenVINOGraph ctor. * Add support for multiple I/O data types Adds support for the following tensor data types for graph inputs and outputs: 1) float 2) float16 3) int32 4) int16 5) int8 6) uint16 7) uint8 * cleanup setup.py module list definition * Deduce index of input using tracked input index map Ignores initializers in case they are ordered before inputs. * Removed debug statement in MO code Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * PR feedback * Removed per_sample_tolerance for openvino * Removed unnecessary disabled tests Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Removed debug function Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled tiny_yolo_v2 due to accuracy issues Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Changed the disabled reason for broken tests Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Disabled Reshape with no input Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Python formatting with Autopep8 * Minor fix for MYRIAD devices * Added zero dimension check *Removed setting batch size for the network Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Set the threshold to larger value for MNIST Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Removed setting higher threshold in provider_test_utils Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com> * Check for --use_openvino in python wheel setup.py Add openvino modules to the setup script for building the wheel package only for --use_openvino a build option. * Removed nullptr checks for GetNode() Signed-off-by: suryasidd <surya.siddharth.pemmaraju@intel.com>
677 lines
27 KiB
CMake
677 lines
27 KiB
CMake
# Copyright (c) Microsoft Corporation. All rights reserved.
|
|
# Licensed under the MIT License.
|
|
|
|
set(TEST_SRC_DIR ${ONNXRUNTIME_ROOT}/test)
|
|
set(TEST_INC_DIR ${ONNXRUNTIME_ROOT})
|
|
if (onnxruntime_USE_TVM)
|
|
list(APPEND TEST_INC_DIR ${TVM_INCLUDES})
|
|
endif()
|
|
|
|
if (onnxruntime_USE_OPENVINO)
|
|
list(APPEND TEST_INC_DIR ${OPENVINO_INCLUDE_DIR})
|
|
endif()
|
|
|
|
set(disabled_warnings)
|
|
set(extra_includes)
|
|
function(AddTest)
|
|
cmake_parse_arguments(_UT "DYN" "TARGET" "LIBS;SOURCES;DEPENDS" ${ARGN})
|
|
if(_UT_LIBS)
|
|
list(REMOVE_DUPLICATES _UT_LIBS)
|
|
endif()
|
|
list(REMOVE_DUPLICATES _UT_SOURCES)
|
|
|
|
if (_UT_DEPENDS)
|
|
list(REMOVE_DUPLICATES _UT_DEPENDS)
|
|
endif(_UT_DEPENDS)
|
|
|
|
add_executable(${_UT_TARGET} ${_UT_SOURCES})
|
|
|
|
source_group(TREE ${TEST_SRC_DIR} FILES ${_UT_SOURCES})
|
|
set_target_properties(${_UT_TARGET} PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
if (_UT_DEPENDS)
|
|
add_dependencies(${_UT_TARGET} ${_UT_DEPENDS})
|
|
endif(_UT_DEPENDS)
|
|
if(_UT_DYN)
|
|
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest gmock onnxruntime ${CMAKE_DL_LIBS} Threads::Threads)
|
|
else()
|
|
target_link_libraries(${_UT_TARGET} PRIVATE ${_UT_LIBS} gtest gmock ${onnxruntime_EXTERNAL_LIBRARIES})
|
|
endif()
|
|
onnxruntime_add_include_to_target(${_UT_TARGET} date_interface gsl)
|
|
target_include_directories(${_UT_TARGET} PRIVATE ${TEST_INC_DIR})
|
|
if (onnxruntime_USE_CUDA)
|
|
target_include_directories(${_UT_TARGET} PRIVATE ${CUDA_INCLUDE_DIRS} ${onnxruntime_CUDNN_HOME}/include)
|
|
endif()
|
|
if (WIN32)
|
|
if (onnxruntime_USE_CUDA)
|
|
# disable a warning from the CUDA headers about unreferenced local functions
|
|
if (MSVC)
|
|
target_compile_options(${_UT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler /wd4505>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/wd4505>")
|
|
endif()
|
|
endif()
|
|
target_compile_options(${_UT_TARGET} PRIVATE ${disabled_warnings})
|
|
else()
|
|
target_compile_options(${_UT_TARGET} PRIVATE ${DISABLED_WARNINGS_FOR_TVM})
|
|
target_compile_options(${_UT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
|
|
endif()
|
|
|
|
set(TEST_ARGS)
|
|
if (onnxruntime_GENERATE_TEST_REPORTS)
|
|
# generate a report file next to the test program
|
|
list(APPEND TEST_ARGS
|
|
"--gtest_output=xml:$<SHELL_PATH:$<TARGET_FILE:${_UT_TARGET}>.$<CONFIG>.results.xml>")
|
|
endif(onnxruntime_GENERATE_TEST_REPORTS)
|
|
|
|
add_test(NAME ${_UT_TARGET}
|
|
COMMAND ${_UT_TARGET} ${TEST_ARGS}
|
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:${_UT_TARGET}>
|
|
)
|
|
endfunction(AddTest)
|
|
|
|
#Do not add '${TEST_SRC_DIR}/util/include' to your include directories directly
|
|
#Use onnxruntime_add_include_to_target or target_link_libraries, so that compile definitions
|
|
#can propagate correctly.
|
|
|
|
file(GLOB onnxruntime_test_utils_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/util/include/*.h"
|
|
"${TEST_SRC_DIR}/util/*.cc"
|
|
)
|
|
|
|
file(GLOB onnxruntime_test_common_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/common/*.cc"
|
|
"${TEST_SRC_DIR}/common/*.h"
|
|
"${TEST_SRC_DIR}/common/logging/*.cc"
|
|
"${TEST_SRC_DIR}/common/logging/*.h"
|
|
)
|
|
|
|
file(GLOB onnxruntime_test_ir_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/ir/*.cc"
|
|
"${TEST_SRC_DIR}/ir/*.h"
|
|
)
|
|
|
|
file(GLOB onnxruntime_test_optimizer_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/optimizer/*.cc"
|
|
"${TEST_SRC_DIR}/optimizer/*.h"
|
|
)
|
|
|
|
set(onnxruntime_test_framework_src_patterns
|
|
"${TEST_SRC_DIR}/framework/*.cc"
|
|
"${TEST_SRC_DIR}/framework/*.h"
|
|
"${TEST_SRC_DIR}/platform/*.cc"
|
|
)
|
|
|
|
if(WIN32)
|
|
list(APPEND onnxruntime_test_framework_src_patterns
|
|
"${TEST_SRC_DIR}/platform/windows/*.cc"
|
|
"${TEST_SRC_DIR}/platform/windows/logging/*.cc" )
|
|
endif()
|
|
|
|
if(onnxruntime_USE_CUDA)
|
|
list(APPEND onnxruntime_test_framework_src_patterns ${TEST_SRC_DIR}/framework/cuda/*)
|
|
endif()
|
|
|
|
set(onnxruntime_test_providers_src_patterns
|
|
"${TEST_SRC_DIR}/providers/*.h"
|
|
"${TEST_SRC_DIR}/providers/*.cc"
|
|
"${TEST_SRC_DIR}/framework/TestAllocatorManager.cc"
|
|
"${TEST_SRC_DIR}/framework/TestAllocatorManager.h"
|
|
)
|
|
if(NOT onnxruntime_DISABLE_CONTRIB_OPS)
|
|
list(APPEND onnxruntime_test_providers_src_patterns
|
|
"${TEST_SRC_DIR}/contrib_ops/*.h"
|
|
"${TEST_SRC_DIR}/contrib_ops/*.cc")
|
|
endif()
|
|
|
|
file(GLOB onnxruntime_test_providers_src CONFIGURE_DEPENDS
|
|
${onnxruntime_test_providers_src_patterns})
|
|
file(GLOB_RECURSE onnxruntime_test_providers_cpu_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/providers/cpu/*"
|
|
)
|
|
list(APPEND onnxruntime_test_providers_src ${onnxruntime_test_providers_cpu_src})
|
|
|
|
if (onnxruntime_USE_NGRAPH)
|
|
file(GLOB_RECURSE onnxruntime_test_providers_ngraph_src CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/providers/ngraph/*"
|
|
)
|
|
list(APPEND onnxruntime_test_providers_src ${onnxruntime_test_providers_ngraph_src})
|
|
endif()
|
|
|
|
# tests from lowest level library up.
|
|
# the order of libraries should be maintained, with higher libraries being added first in the list
|
|
|
|
set(onnxruntime_test_common_libs
|
|
onnxruntime_test_utils
|
|
onnxruntime_common
|
|
)
|
|
|
|
set(onnxruntime_test_ir_libs
|
|
onnxruntime_test_utils
|
|
onnxruntime_graph
|
|
onnxruntime_common
|
|
)
|
|
|
|
set(onnxruntime_test_optimizer_libs
|
|
onnxruntime_test_utils
|
|
onnxruntime_framework
|
|
onnxruntime_util
|
|
onnxruntime_graph
|
|
onnxruntime_common
|
|
)
|
|
|
|
set(onnxruntime_test_framework_libs
|
|
onnxruntime_test_utils_for_framework
|
|
onnxruntime_framework
|
|
onnxruntime_util
|
|
onnxruntime_graph
|
|
onnxruntime_common
|
|
onnxruntime_mlas
|
|
)
|
|
|
|
set(onnxruntime_test_server_libs
|
|
onnxruntime_test_utils_for_framework
|
|
onnxruntime_test_utils_for_server
|
|
)
|
|
|
|
if(WIN32)
|
|
list(APPEND onnxruntime_test_framework_libs Advapi32)
|
|
endif()
|
|
|
|
set (onnxruntime_test_providers_dependencies ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
|
|
if(onnxruntime_USE_CUDA)
|
|
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_cuda)
|
|
endif()
|
|
|
|
if(onnxruntime_USE_MKLDNN)
|
|
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_mkldnn)
|
|
endif()
|
|
|
|
if(onnxruntime_USE_NGRAPH)
|
|
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_ngraph)
|
|
endif()
|
|
|
|
if(onnxruntime_USE_OPENVINO)
|
|
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_openvino)
|
|
endif()
|
|
|
|
file(GLOB_RECURSE onnxruntime_test_tvm_src CONFIGURE_DEPENDS
|
|
"${ONNXRUNTIME_ROOT}/test/tvm/*.h"
|
|
"${ONNXRUNTIME_ROOT}/test/tvm/*.cc"
|
|
)
|
|
|
|
file(GLOB_RECURSE onnxruntime_test_openvino_src
|
|
"${ONNXRUNTIME_ROOT}/test/openvino/*.h"
|
|
"${ONNXRUNTIME_ROOT}/test/openvino/*.cc"
|
|
)
|
|
|
|
if (onnxruntime_ENABLE_MICROSOFT_INTERNAL)
|
|
include(onnxruntime_unittests_internal.cmake)
|
|
endif()
|
|
|
|
set(ONNXRUNTIME_TEST_LIBS
|
|
onnxruntime_session
|
|
${onnxruntime_libs}
|
|
${PROVIDERS_CUDA}
|
|
${PROVIDERS_MKLDNN}
|
|
${PROVIDERS_TENSORRT}
|
|
${PROVIDERS_NGRAPH}
|
|
${PROVIDERS_OPENVINO}
|
|
onnxruntime_optimizer
|
|
onnxruntime_providers
|
|
onnxruntime_util
|
|
${onnxruntime_tvm_libs}
|
|
onnxruntime_framework
|
|
onnxruntime_util
|
|
onnxruntime_graph
|
|
onnxruntime_common
|
|
onnxruntime_mlas
|
|
)
|
|
|
|
set(onnxruntime_test_providers_libs
|
|
onnxruntime_test_utils_for_framework
|
|
${ONNXRUNTIME_TEST_LIBS}
|
|
)
|
|
|
|
if(onnxruntime_USE_TENSORRT)
|
|
list(APPEND onnxruntime_test_framework_src_patterns ${TEST_SRC_DIR}/providers/tensorrt/*)
|
|
list(APPEND onnxruntime_test_framework_libs onnxruntime_providers_tensorrt)
|
|
list(APPEND onnxruntime_test_providers_dependencies onnxruntime_providers_tensorrt)
|
|
list(APPEND onnxruntime_test_providers_libs onnxruntime_providers_tensorrt)
|
|
endif()
|
|
|
|
if(WIN32)
|
|
if (onnxruntime_USE_TVM)
|
|
list(APPEND disabled_warnings ${DISABLED_WARNINGS_FOR_TVM})
|
|
endif()
|
|
endif()
|
|
|
|
file(GLOB onnxruntime_test_framework_src CONFIGURE_DEPENDS
|
|
${onnxruntime_test_framework_src_patterns}
|
|
)
|
|
|
|
#with auto initialize onnxruntime
|
|
add_library(onnxruntime_test_utils_for_framework ${onnxruntime_test_utils_src})
|
|
onnxruntime_add_include_to_target(onnxruntime_test_utils_for_framework onnxruntime_framework gtest gsl onnx onnx_proto)
|
|
if (onnxruntime_USE_FULL_PROTOBUF)
|
|
target_compile_definitions(onnxruntime_test_utils_for_framework PRIVATE USE_FULL_PROTOBUF=1)
|
|
endif()
|
|
if (onnxruntime_USE_MKLDNN)
|
|
target_compile_definitions(onnxruntime_test_utils_for_framework PUBLIC USE_MKLDNN=1)
|
|
endif()
|
|
add_dependencies(onnxruntime_test_utils_for_framework ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnxruntime_test_utils_for_framework PUBLIC "${TEST_SRC_DIR}/util/include" PRIVATE ${eigen_INCLUDE_DIRS} ${ONNXRUNTIME_ROOT})
|
|
# Add the define for conditionally using the framework Environment class in TestEnvironment
|
|
target_compile_definitions(onnxruntime_test_utils_for_framework PUBLIC "HAVE_FRAMEWORK_LIB")
|
|
set_target_properties(onnxruntime_test_utils_for_framework PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
#without auto initialize onnxruntime
|
|
add_library(onnxruntime_test_utils ${onnxruntime_test_utils_src})
|
|
onnxruntime_add_include_to_target(onnxruntime_test_utils onnxruntime_framework gtest gsl onnx onnx_proto)
|
|
if (onnxruntime_USE_FULL_PROTOBUF)
|
|
target_compile_definitions(onnxruntime_test_utils PRIVATE USE_FULL_PROTOBUF=1)
|
|
endif()
|
|
if (onnxruntime_USE_MKLDNN)
|
|
target_compile_definitions(onnxruntime_test_utils PUBLIC USE_MKLDNN=1)
|
|
endif()
|
|
add_dependencies(onnxruntime_test_utils ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnxruntime_test_utils PUBLIC "${TEST_SRC_DIR}/util/include" PRIVATE ${eigen_INCLUDE_DIRS} ${ONNXRUNTIME_ROOT})
|
|
set_target_properties(onnxruntime_test_utils PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
if (SingleUnitTestProject)
|
|
set(all_tests ${onnxruntime_test_common_src} ${onnxruntime_test_ir_src} ${onnxruntime_test_optimizer_src} ${onnxruntime_test_framework_src} ${onnxruntime_test_providers_src})
|
|
set(all_dependencies ${onnxruntime_test_providers_dependencies} )
|
|
|
|
if (onnxruntime_USE_TVM)
|
|
list(APPEND all_tests ${onnxruntime_test_tvm_src})
|
|
endif()
|
|
if (onnxruntime_USE_OPENVINO)
|
|
list(APPEND all_tests ${onnxruntime_test_openvino_src})
|
|
endif()
|
|
# we can only have one 'main', so remove them all and add back the providers test_main as it sets
|
|
# up everything we need for all tests
|
|
file(GLOB_RECURSE test_mains CONFIGURE_DEPENDS
|
|
"${TEST_SRC_DIR}/*/test_main.cc"
|
|
)
|
|
list(REMOVE_ITEM all_tests ${test_mains})
|
|
list(APPEND all_tests "${TEST_SRC_DIR}/providers/test_main.cc")
|
|
|
|
# this is only added to onnxruntime_test_framework_libs above, but we use onnxruntime_test_providers_libs for the onnxruntime_test_all target.
|
|
# for now, add it here. better is probably to have onnxruntime_test_providers_libs use the full onnxruntime_test_framework_libs
|
|
# list given it's built on top of that library and needs all the same dependencies.
|
|
if(WIN32)
|
|
list(APPEND onnxruntime_test_providers_libs Advapi32)
|
|
endif()
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_test_all
|
|
SOURCES ${all_tests}
|
|
LIBS ${onnxruntime_test_providers_libs} ${onnxruntime_test_common_libs}
|
|
DEPENDS ${all_dependencies}
|
|
)
|
|
|
|
# the default logger tests conflict with the need to have an overall default logger
|
|
# so skip in this type of
|
|
target_compile_definitions(onnxruntime_test_all PUBLIC -DSKIP_DEFAULT_LOGGER_TESTS)
|
|
|
|
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS)
|
|
target_link_libraries(onnxruntime_test_all PRIVATE onnxruntime_language_interop onnxruntime_pyop)
|
|
endif()
|
|
|
|
set(test_data_target onnxruntime_test_all)
|
|
else()
|
|
AddTest(
|
|
TARGET onnxruntime_test_common
|
|
SOURCES ${onnxruntime_test_common_src}
|
|
LIBS ${onnxruntime_test_common_libs}
|
|
DEPENDS ${onnxruntime_EXTERNAL_DEPENDENCIES}
|
|
)
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_test_ir
|
|
SOURCES ${onnxruntime_test_ir_src}
|
|
LIBS ${onnxruntime_test_ir_libs}
|
|
DEPENDS ${onnxruntime_EXTERNAL_DEPENDENCIES}
|
|
)
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_test_optimizer
|
|
SOURCES ${onnxruntime_test_optimizer_src}
|
|
LIBS ${onnxruntime_test_optimizer_libs}
|
|
DEPENDS ${onnxruntime_EXTERNAL_DEPENDENCIES}
|
|
)
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_test_framework
|
|
SOURCES ${onnxruntime_test_framework_src}
|
|
LIBS ${onnxruntime_test_framework_libs}
|
|
# code smell! see if CPUExecutionProvider should move to framework so onnxruntime_providers isn't needed.
|
|
DEPENDS ${onnxruntime_test_providers_dependencies}
|
|
)
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_test_providers
|
|
SOURCES ${onnxruntime_test_providers_src}
|
|
LIBS ${onnxruntime_test_providers_libs}
|
|
DEPENDS ${onnxruntime_test_providers_dependencies}
|
|
)
|
|
|
|
set(test_data_target onnxruntime_test_ir)
|
|
endif() # SingleUnitTestProject
|
|
|
|
# standalone test for inference session without environment
|
|
# the normal test executables set up a default runtime environment, which we don't want here
|
|
if(NOT ipo_enabled)
|
|
#TODO: figure out why this test doesn't work with gcc LTO
|
|
AddTest(
|
|
TARGET onnxruntime_test_framework_session_without_environment_standalone
|
|
SOURCES "${TEST_SRC_DIR}/framework/inference_session_without_environment/inference_session_without_environment_standalone_test.cc" "${TEST_SRC_DIR}/framework/test_main.cc"
|
|
LIBS onnxruntime_test_utils ${ONNXRUNTIME_TEST_LIBS}
|
|
DEPENDS ${onnxruntime_EXTERNAL_DEPENDENCIES}
|
|
)
|
|
endif()
|
|
|
|
#
|
|
# onnxruntime_ir_graph test data
|
|
#
|
|
set(TEST_DATA_SRC ${TEST_SRC_DIR}/testdata)
|
|
set(TEST_DATA_DES $<TARGET_FILE_DIR:${test_data_target}>/testdata)
|
|
|
|
# Copy test data from source to destination.
|
|
add_custom_command(
|
|
TARGET ${test_data_target} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${TEST_DATA_SRC}
|
|
${TEST_DATA_DES})
|
|
if(WIN32)
|
|
if (onnxruntime_USE_MKLDNN)
|
|
list(APPEND onnx_test_libs mkldnn)
|
|
add_custom_command(
|
|
TARGET ${test_data_target} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy ${MKLDNN_DLL_PATH} $<TARGET_FILE_DIR:${test_data_target}>
|
|
)
|
|
endif()
|
|
if (onnxruntime_USE_MKLML)
|
|
add_custom_command(
|
|
TARGET ${test_data_target} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${MKLML_LIB_DIR}/${MKLML_SHARED_LIB} ${MKLML_LIB_DIR}/${IOMP5MD_SHARED_LIB}
|
|
$<TARGET_FILE_DIR:${test_data_target}>
|
|
)
|
|
endif()
|
|
if (onnxruntime_USE_NGRAPH)
|
|
add_custom_command(
|
|
TARGET ${test_data_target} POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${ngraph_LIBRARIES}/
|
|
$<TARGET_FILE_DIR:${test_data_target}>
|
|
)
|
|
endif()
|
|
endif()
|
|
|
|
add_library(onnx_test_data_proto ${TEST_SRC_DIR}/proto/tml.proto)
|
|
if(WIN32)
|
|
target_compile_options(onnx_test_data_proto PRIVATE "/wd4125" "/wd4456")
|
|
endif()
|
|
add_dependencies(onnx_test_data_proto onnx_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
|
|
if(NOT WIN32)
|
|
if(HAS_UNUSED_PARAMETER)
|
|
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/tml.pb.cc PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
|
|
endif()
|
|
endif()
|
|
onnxruntime_add_include_to_target(onnx_test_data_proto onnx_proto)
|
|
target_include_directories(onnx_test_data_proto PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx)
|
|
set_target_properties(onnx_test_data_proto PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
onnxruntime_protobuf_generate(APPEND_PATH IMPORT_DIRS ${ONNXRUNTIME_ROOT}/core/protobuf TARGET onnx_test_data_proto)
|
|
|
|
set(onnx_test_runner_src_dir ${TEST_SRC_DIR}/onnx)
|
|
set(onnx_test_runner_common_srcs
|
|
${onnx_test_runner_src_dir}/TestResultStat.cc
|
|
${onnx_test_runner_src_dir}/TestResultStat.h
|
|
${onnx_test_runner_src_dir}/testenv.h
|
|
${onnx_test_runner_src_dir}/FixedCountFinishCallback.h
|
|
${onnx_test_runner_src_dir}/TestCaseResult.cc
|
|
${onnx_test_runner_src_dir}/TestCaseResult.h
|
|
${onnx_test_runner_src_dir}/testenv.cc
|
|
${onnx_test_runner_src_dir}/heap_buffer.h
|
|
${onnx_test_runner_src_dir}/heap_buffer.cc
|
|
${onnx_test_runner_src_dir}/OrtValueList.h
|
|
${onnx_test_runner_src_dir}/runner.h
|
|
${onnx_test_runner_src_dir}/runner.cc
|
|
${onnx_test_runner_src_dir}/TestCase.cc
|
|
${onnx_test_runner_src_dir}/TestCase.h
|
|
${onnx_test_runner_src_dir}/onnxruntime_event.h
|
|
${onnx_test_runner_src_dir}/sync_api.h
|
|
${onnx_test_runner_src_dir}/sync_api.cc)
|
|
|
|
if(WIN32)
|
|
set(wide_get_opt_src_dir ${TEST_SRC_DIR}/win_getopt/wide)
|
|
add_library(win_getopt_wide ${wide_get_opt_src_dir}/getopt.cc ${wide_get_opt_src_dir}/include/getopt.h)
|
|
target_include_directories(win_getopt_wide INTERFACE ${wide_get_opt_src_dir}/include)
|
|
set_target_properties(win_getopt_wide PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
set(onnx_test_runner_common_srcs ${onnx_test_runner_common_srcs})
|
|
set(GETOPT_LIB_WIDE win_getopt_wide)
|
|
endif()
|
|
|
|
add_library(onnx_test_runner_common ${onnx_test_runner_common_srcs})
|
|
onnxruntime_add_include_to_target(onnx_test_runner_common onnxruntime_common onnxruntime_framework onnxruntime_test_utils gsl onnx onnx_proto)
|
|
add_dependencies(onnx_test_runner_common onnx_test_data_proto ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnx_test_runner_common PRIVATE ${eigen_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx ${ONNXRUNTIME_ROOT})
|
|
set_target_properties(onnx_test_runner_common PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
set(onnx_test_libs
|
|
onnxruntime_test_utils
|
|
${ONNXRUNTIME_TEST_LIBS}
|
|
onnx_test_data_proto)
|
|
|
|
list(APPEND onnx_test_libs ${onnxruntime_EXTERNAL_LIBRARIES} libprotobuf) # test code uses delimited parsing and hence needs to link with the full protobuf
|
|
|
|
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS)
|
|
list(APPEND onnx_test_libs onnxruntime_language_interop onnxruntime_pyop)
|
|
endif()
|
|
|
|
add_executable(onnx_test_runner ${onnx_test_runner_src_dir}/main.cc)
|
|
target_link_libraries(onnx_test_runner PRIVATE onnx_test_runner_common ${GETOPT_LIB_WIDE} ${onnx_test_libs})
|
|
onnxruntime_add_include_to_target(onnx_test_runner gsl)
|
|
target_include_directories(onnx_test_runner PRIVATE ${ONNXRUNTIME_ROOT})
|
|
set_target_properties(onnx_test_runner PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
install(TARGETS onnx_test_runner
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
|
|
|
if(onnxruntime_BUILD_BENCHMARKS)
|
|
add_executable(onnxruntime_benchmark ${TEST_SRC_DIR}/onnx/microbenchmark/main.cc ${TEST_SRC_DIR}/onnx/microbenchmark/modeltest.cc ${TEST_SRC_DIR}/onnx/microbenchmark/model_init.cc)
|
|
target_include_directories(onnxruntime_benchmark PRIVATE ${ONNXRUNTIME_ROOT} ${onnxruntime_graph_header} benchmark)
|
|
onnxruntime_add_include_to_target(onnxruntime_benchmark gsl)
|
|
if(WIN32)
|
|
target_compile_options(onnxruntime_benchmark PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler /wd4141>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:/wd4141>")
|
|
endif()
|
|
target_link_libraries(onnxruntime_benchmark PRIVATE onnx_test_runner_common benchmark ${onnx_test_libs})
|
|
add_dependencies(onnxruntime_benchmark ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
set_target_properties(onnxruntime_benchmark PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
endif()
|
|
|
|
if(WIN32)
|
|
target_compile_options(onnx_test_runner_common PRIVATE -D_CRT_SECURE_NO_WARNINGS)
|
|
endif()
|
|
|
|
add_test(NAME onnx_test_pytorch_converted
|
|
COMMAND onnx_test_runner ${PROJECT_SOURCE_DIR}/external/onnx/onnx/backend/test/data/pytorch-converted)
|
|
add_test(NAME onnx_test_pytorch_operator
|
|
COMMAND onnx_test_runner ${PROJECT_SOURCE_DIR}/external/onnx/onnx/backend/test/data/pytorch-operator)
|
|
|
|
#perf test runner
|
|
set(onnxruntime_perf_test_src_dir ${TEST_SRC_DIR}/perftest)
|
|
set(onnxruntime_perf_test_src_patterns
|
|
"${onnxruntime_perf_test_src_dir}/*.cc"
|
|
"${onnxruntime_perf_test_src_dir}/*.h")
|
|
|
|
if(WIN32)
|
|
list(APPEND onnxruntime_perf_test_src_patterns
|
|
"${onnxruntime_perf_test_src_dir}/windows/*.cc"
|
|
"${onnxruntime_perf_test_src_dir}/windows/*.h" )
|
|
else ()
|
|
list(APPEND onnxruntime_perf_test_src_patterns
|
|
"${onnxruntime_perf_test_src_dir}/posix/*.cc"
|
|
"${onnxruntime_perf_test_src_dir}/posix/*.h" )
|
|
endif()
|
|
|
|
file(GLOB onnxruntime_perf_test_src CONFIGURE_DEPENDS
|
|
${onnxruntime_perf_test_src_patterns}
|
|
)
|
|
add_executable(onnxruntime_perf_test ${onnxruntime_perf_test_src} ${ONNXRUNTIME_ROOT}/core/framework/path_lib.cc)
|
|
|
|
target_include_directories(onnxruntime_perf_test PRIVATE ${onnx_test_runner_src_dir} ${ONNXRUNTIME_ROOT}
|
|
${eigen_INCLUDE_DIRS} ${extra_includes} ${onnxruntime_graph_header} ${onnxruntime_exec_src_dir}
|
|
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/onnx)
|
|
if (WIN32)
|
|
target_compile_options(onnxruntime_perf_test PRIVATE ${disabled_warnings})
|
|
SET(SYS_PATH_LIB shlwapi)
|
|
endif()
|
|
onnxruntime_add_include_to_target(onnxruntime_perf_test gsl)
|
|
|
|
if (onnxruntime_BUILD_SHARED_LIB)
|
|
set(onnxruntime_perf_test_libs onnxruntime_test_utils onnx_test_runner_common onnxruntime_common
|
|
onnx_test_data_proto onnx_proto libprotobuf ${GETOPT_LIB_WIDE} onnxruntime
|
|
${SYS_PATH_LIB} ${CMAKE_DL_LIBS})
|
|
if(onnxruntime_USE_NSYNC)
|
|
list(APPEND onnxruntime_perf_test_libs nsync_cpp)
|
|
endif()
|
|
target_link_libraries(onnxruntime_perf_test PRIVATE ${onnxruntime_perf_test_libs} Threads::Threads)
|
|
if(tensorflow_C_PACKAGE_PATH)
|
|
target_include_directories(onnxruntime_perf_test PRIVATE ${tensorflow_C_PACKAGE_PATH}/include)
|
|
target_link_directories(onnxruntime_perf_test PRIVATE ${tensorflow_C_PACKAGE_PATH}/lib)
|
|
target_link_libraries(onnxruntime_perf_test PRIVATE tensorflow)
|
|
target_compile_definitions(onnxruntime_perf_test PRIVATE HAVE_TENSORFLOW)
|
|
endif()
|
|
else()
|
|
target_link_libraries(onnxruntime_perf_test PRIVATE onnx_test_runner_common ${GETOPT_LIB_WIDE} ${onnx_test_libs})
|
|
endif()
|
|
set_target_properties(onnxruntime_perf_test PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
if (onnxruntime_ENABLE_LANGUAGE_INTEROP_OPS AND NOT onnxruntime_BUILD_SHARED_LIB)
|
|
target_link_libraries(onnxruntime_perf_test PRIVATE onnxruntime_language_interop onnxruntime_pyop)
|
|
endif()
|
|
|
|
# shared lib
|
|
if (onnxruntime_BUILD_SHARED_LIB)
|
|
add_library(onnxruntime_mocked_allocator ${ONNXRUNTIME_ROOT}/test/util/test_allocator.cc)
|
|
target_include_directories(onnxruntime_mocked_allocator PUBLIC ${ONNXRUNTIME_ROOT}/test/util/include)
|
|
set_target_properties(onnxruntime_mocked_allocator PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
|
|
#################################################################
|
|
# test inference using shared lib
|
|
set (ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR "${ONNXRUNTIME_ROOT}/test/shared_lib")
|
|
set (onnxruntime_shared_lib_test_SRC
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_fixture.h
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_inference.cc
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_session_options.cc
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_run_options.cc
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_allocator.cc
|
|
${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_nontensor_types.cc)
|
|
if(onnxruntime_RUN_ONNX_TESTS)
|
|
list(APPEND onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_io_types.cc)
|
|
endif()
|
|
if (NOT(${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
|
#for some reason, these tests are failing. Need investigation.
|
|
list(APPEND onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_tensor_loader.cc)
|
|
if (onnxruntime_USE_FULL_PROTOBUF)
|
|
list(APPEND onnxruntime_shared_lib_test_SRC ${ONNXRUNTIME_SHARED_LIB_TEST_SRC_DIR}/test_model_loading.cc)
|
|
endif()
|
|
endif()
|
|
set(onnxruntime_shared_lib_test_LIBS onnxruntime_mocked_allocator onnxruntime_test_utils onnxruntime_common
|
|
onnx_proto)
|
|
if(onnxruntime_USE_NSYNC)
|
|
list(APPEND onnxruntime_shared_lib_test_LIBS nsync_cpp)
|
|
endif()
|
|
AddTest(DYN
|
|
TARGET onnxruntime_shared_lib_test
|
|
SOURCES ${onnxruntime_shared_lib_test_SRC}
|
|
LIBS ${onnxruntime_shared_lib_test_LIBS}
|
|
protobuf::libprotobuf
|
|
DEPENDS ${all_dependencies}
|
|
)
|
|
#demo
|
|
message("PNG Lib Dir = ${PNG_LIBRARIES}")
|
|
message("PNG Include Dir = ${PNG_INCLUDE_DIRS}")
|
|
if(PNG_FOUND AND NOT WIN32) # for some reason some symbols are not found in Win32 PNG module
|
|
add_executable(fns_candy_style_transfer "${ONNXRUNTIME_ROOT}/test/shared_lib/fns_candy_style_transfer.c")
|
|
target_include_directories(fns_candy_style_transfer PRIVATE "${TEST_SRC_DIR}/util/include" ${PNG_INCLUDE_DIRS})
|
|
target_link_libraries(fns_candy_style_transfer PRIVATE onnxruntime ${PNG_LIBRARIES})
|
|
set_target_properties(fns_candy_style_transfer PROPERTIES FOLDER "ONNXRuntimeTest")
|
|
endif()
|
|
endif()
|
|
|
|
if (onnxruntime_BUILD_SERVER)
|
|
file(GLOB onnxruntime_test_server_src
|
|
"${TEST_SRC_DIR}/server/unit_tests/*.cc"
|
|
"${TEST_SRC_DIR}/server/unit_tests/*.h"
|
|
)
|
|
|
|
file(GLOB onnxruntime_integration_test_server_src
|
|
"${TEST_SRC_DIR}/server/integration_tests/*.py"
|
|
)
|
|
if(NOT WIN32)
|
|
if(HAS_UNUSED_PARAMETER)
|
|
set_source_files_properties("${TEST_SRC_DIR}/server/unit_tests/json_handling_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
|
|
set_source_files_properties("${TEST_SRC_DIR}/server/unit_tests/converter_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
|
|
set_source_files_properties("${TEST_SRC_DIR}/server/unit_tests/util_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
|
|
set_source_files_properties("${TEST_SRC_DIR}/server/unit_tests/executor_test.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
|
|
endif()
|
|
endif()
|
|
|
|
add_library(onnxruntime_test_utils_for_server ${onnxruntime_test_server_src})
|
|
onnxruntime_add_include_to_target(onnxruntime_test_utils_for_server onnxruntime_test_utils_for_framework gtest gmock gsl onnx onnx_proto server_proto)
|
|
add_dependencies(onnxruntime_test_utils_for_server onnxruntime_server_lib onnxruntime_server_http_core_lib Boost ${onnxruntime_EXTERNAL_DEPENDENCIES})
|
|
target_include_directories(onnxruntime_test_utils_for_server PUBLIC ${Boost_INCLUDE_DIR} ${REPO_ROOT}/cmake/external/re2 ${CMAKE_CURRENT_BINARY_DIR}/onnx ${ONNXRUNTIME_ROOT}/server/http ${ONNXRUNTIME_ROOT}/server/http/core PRIVATE ${ONNXRUNTIME_ROOT} )
|
|
if(UNIX)
|
|
target_compile_options(onnxruntime_test_utils_for_server PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
|
|
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
|
|
endif()
|
|
target_link_libraries(onnxruntime_test_utils_for_server ${Boost_LIBRARIES})
|
|
|
|
|
|
AddTest(
|
|
TARGET onnxruntime_server_tests
|
|
SOURCES ${onnxruntime_test_server_src}
|
|
LIBS ${onnxruntime_test_server_libs} server_proto onnxruntime_server_lib ${onnxruntime_test_providers_libs}
|
|
DEPENDS ${onnxruntime_EXTERNAL_DEPENDENCIES}
|
|
)
|
|
|
|
onnxruntime_protobuf_generate(
|
|
APPEND_PATH IMPORT_DIRS ${REPO_ROOT}/cmake/external/protobuf/src ${ONNXRUNTIME_ROOT}/server/protobuf ${ONNXRUNTIME_ROOT}/core/protobuf
|
|
PROTOS ${ONNXRUNTIME_ROOT}/server/protobuf/predict.proto ${ONNXRUNTIME_ROOT}/server/protobuf/onnx-ml.proto
|
|
LANGUAGE python
|
|
TARGET onnxruntime_server_tests
|
|
OUT_VAR server_test_py)
|
|
|
|
add_custom_command(
|
|
TARGET onnxruntime_server_tests POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/server_test
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${onnxruntime_integration_test_server_src}
|
|
${CMAKE_CURRENT_BINARY_DIR}/server_test/
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${CMAKE_CURRENT_BINARY_DIR}/onnx_ml_pb2.py
|
|
${CMAKE_CURRENT_BINARY_DIR}/server_test/
|
|
COMMAND ${CMAKE_COMMAND} -E copy
|
|
${CMAKE_CURRENT_BINARY_DIR}/predict_pb2.py
|
|
${CMAKE_CURRENT_BINARY_DIR}/server_test/
|
|
)
|
|
|
|
endif()
|
|
|
|
add_executable(onnxruntime_mlas_test ${TEST_SRC_DIR}/mlas/unittest.cpp)
|
|
target_include_directories(onnxruntime_mlas_test PRIVATE ${ONNXRUNTIME_ROOT}/core/mlas/inc)
|
|
set(onnxruntime_mlas_test_libs onnxruntime_mlas onnxruntime_common)
|
|
if(onnxruntime_USE_NSYNC)
|
|
list(APPEND onnxruntime_mlas_test_libs nsync_cpp)
|
|
endif()
|
|
list(APPEND onnxruntime_mlas_test_libs Threads::Threads)
|
|
target_link_libraries(onnxruntime_mlas_test PRIVATE ${onnxruntime_mlas_test_libs})
|
|
set_target_properties(onnxruntime_mlas_test PROPERTIES FOLDER "ONNXRuntimeTest")
|