Changes related to the release binaries requiring Visual C++ 2019 runtime (#3871)

This commit is contained in:
Hariharan Seshadri 2020-05-12 17:07:06 -07:00 committed by GitHub
parent bccbdd03f1
commit 3065219cc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 12 deletions

View file

@ -129,7 +129,8 @@ The complete list of build options can be found by running `./build.sh (or .\bui
### CUDA
#### Pre-Requisites
* Install [CUDA](https://developer.nvidia.com/cuda-toolkit) and [cuDNN](https://developer.nvidia.com/cudnn)
* ONNX Runtime is built and tested with CUDA 10.0 and cuDNN 7.6 using the Visual Studio 2017 14.11 toolset (i.e. Visual Studio 2017 v15.3). CUDA versions from 9.1 up to 10.1, and cuDNN versions from 7.1 up to 7.4 should also work with Visual Studio 2017.
* ONNX Runtime is built and tested with CUDA 10.1 and cuDNN 7.6 using the Visual Studio 2019 14.12 toolset (i.e. Visual Studio 2019 v16.5).
ONNX Runtime can also be built with CUDA versions from 9.1 up to 10.1, and cuDNN versions from 7.1 up to 7.4.
* The path to the CUDA installation must be provided via the CUDA_PATH environment variable, or the `--cuda_home parameter`
* The path to the cuDNN installation (include the `cuda` folder in the path) must be provided via the cuDNN_PATH environment variable, or `--cudnn_home parameter`. The cuDNN path should contain `bin`, `include` and `lib` directories.
* The path to the cuDNN bin directory must be added to the PATH environment variable so that cudnn64_7.dll is found.

View file

@ -133,6 +133,7 @@ These system requirements must be met for using the compiled binaries.
* Follow similar procedure to configure other locales on other platforms.
#### Default CPU
* Requires [Visual C++ 2019 runtime](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
* ONNX Runtime binaries in the CPU packages use OpenMP and depend on the library being available at runtime in the
system.
* For Windows, **OpenMP** support comes as part of VC runtime. It is also available as redist packages:
@ -140,6 +141,7 @@ system.
* For Linux, the system must have **libgomp.so.1** which can be installed using `apt-get install libgomp1`.
#### Default GPU (CUDA)
* Requires [Visual C++ 2019 runtime](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads)
* The default GPU build requires CUDA runtime libraries being installed on the system:
* Version: **CUDA 10.1** and **cuDNN 7.6.5**
* Version dependencies from older ONNX Runtime releases can be found in [prior release notes](https://github.com/microsoft/onnxruntime/releases).

View file

@ -128,12 +128,6 @@ if(NOT WIN32)
set(onnxruntime_ENABLE_INSTRUMENT OFF)
endif()
else()
check_cxx_compiler_flag(/d2FH4- HAS_D2FH4)
if (HAS_D2FH4)
message("Disabling /d2FH4")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /d2FH4-")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /d2FH4-")
endif()
if(WINDOWS_STORE)
# cmake/external/protobuf/src/google/protobuf/compiler/subprocess.cc and onnxruntime/core/platform/windows/env.cc call a bunch of Win32 APIs.
# For now, we'll set the API family to desktop globally to expose Win32 symbols in headers; this must be fixed!

View file

@ -207,9 +207,6 @@ if (onnxruntime_USE_CUDA)
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler -Wno-error=sign-compare>"
"$<$<NOT:$<COMPILE_LANGUAGE:CUDA>>:-Wno-error=sign-compare>")
else()
if(HAS_D2FH4)
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /d2FH4->")
endif()
target_compile_options(onnxruntime_providers_cuda PRIVATE "$<$<COMPILE_LANGUAGE:CUDA>:SHELL:-Xcompiler /wd4127>")
endif()
onnxruntime_add_include_to_target(onnxruntime_providers_cuda onnxruntime_common onnxruntime_framework onnx onnx_proto protobuf::libprotobuf)

View file

@ -11,6 +11,8 @@ Each Python version uses a specific compiler version. In most cases, you should
|2010 | 3.3,3.4 |
|2008 | 2.6, 2.7, 3.0, 3.1, 3.2 |
Currently, ONNXRuntime only supports Visual C++ 2017. Therefore, Python 3.7 seems to be the best choice.
Currently, the official ONNXRuntime Python wheel (v1.3.0 onwards) hosted on PyPi requires [Visual C++ 2019 runtime ](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads) installed on the target machine.
If the Python wheel is built from source using the build toolset provided with Visual Studio 2017, it will work with the Visual C++ 2017 runtime.
CPython 3.7 is distributed with a VC++ 2017 runtime. Unlike the earlier VC++ version, VC++ 2017 Runtime is binary backward compatible with VC++ 2015. Which means you could build your application with VC++ 2015 then run it with VC++ 2017 runtime.

View file

@ -4,10 +4,21 @@
#--------------------------------------------------------------------------
import sys
import os
import platform
import warnings
import onnxruntime.capi._ld_preload
try:
from onnxruntime.capi.onnxruntime_pybind11_state import * # noqa
except ImportError as e:
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'".format(str(e)))
warnings.warn("Cannot load onnxruntime.capi. Error: '{0}'.".format(str(e)))
# If on Windows, check if this import error is caused by the user not installing the 2019 VC Runtime
# The VC Redist installer usually puts the VC Runtime dlls in the System32 folder
# This may not always paint the true picture as anyone building from source using VS 2017 might hit this error
# because the machine might be missing the 2019 VC Runtime but it is not actually needed in that case and the
# import error might actually be due to some other reason.
# TODO: Add a guard against False Positive error message
# As a proxy for checking if the 2019 VC Runtime is installed, we look for a specific dll only shipped with the 2019 VC Runtime
if platform.system().lower() == 'windows' and not os.path.isfile('c:\\Windows\\System32\\vcruntime140_1.dll'):
warnings.warn("Unless you have built the wheel using VS 2017, please install the 2019 Visual C++ runtime and then try again")