Skip to content

Commit

Permalink
onnxruntime: enable cuda provider
Browse files Browse the repository at this point in the history
  • Loading branch information
bverhagen committed Oct 6, 2023
1 parent ea5b3ae commit b25f9ab
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 2 deletions.
6 changes: 6 additions & 0 deletions recipes/onnxruntime/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ patches:
- patch_file: "patches/1.14.1-0004-abseil-no-string-view.patch"
patch_description: "allow to build with abseil built without c++17 support"
patch_type: "portability"
- patch_file: "patches/1.15.1-0002-cuda-gsl.patch"
patch_description: "CMake: fix GSL and cuda"
patch_type: "conan"
"1.14.1":
- patch_file: "patches/1.14.1-0001-cmake-dependencies.patch"
patch_description: "CMake: ensure conan dependencies are used (upstreamed future versions)"
Expand All @@ -32,3 +35,6 @@ patches:
patch_description: "Ensures the forward compatibility with the newest versions of re2 library."
patch_type: "portability"
patch_source: "https://github.com/microsoft/onnxruntime/commit/126e7bf15fa4af8621814b82a3f7bd0d786f0239.patch"
- patch_file: "patches/1.14.1-0006-cuda-gsl.patch"
patch_description: "CMake: fix GSL and cuda"
patch_type: "conan"
7 changes: 5 additions & 2 deletions recipes/onnxruntime/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ class OnnxRuntimeConan(ConanFile):
"shared": [True, False],
"fPIC": [True, False],
"with_xnnpack": [True, False],
"with_cuda_provider": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
"with_xnnpack": False,
"with_cuda_provider": False,
}
short_paths = True

Expand All @@ -44,7 +46,7 @@ def _compilers_minimum_version(self):
return {
"Visual Studio": "16",
"msvc": "192",
"gcc": "7",
"gcc": "8",
"clang": "5",
"apple-clang": "10",
}
Expand Down Expand Up @@ -126,6 +128,7 @@ def generate(self):
tc.variables["onnxruntime_USE_FULL_PROTOBUF"] = not self.dependencies["protobuf"].options.lite
tc.variables["onnxruntime_USE_XNNPACK"] = self.options.with_xnnpack

tc.variables["onnxruntime_USE_CUDA"] = self.options.with_cuda_provider
tc.variables["onnxruntime_BUILD_UNIT_TESTS"] = False
tc.variables["onnxruntime_RUN_ONNX_TESTS"] = False
tc.variables["onnxruntime_GENERATE_TEST_REPORTS"] = False
Expand All @@ -150,7 +153,7 @@ def generate(self):
tc.variables["onnxruntime_TVM_CUDA_RUNTIME"] = False
tc.variables["onnxruntime_TVM_USE_HASH"] = False
tc.variables["onnxruntime_CROSS_COMPILING"] = False
tc.variables["onnxruntime_DISABLE_CONTRIB_OPS"] = False
tc.variables["onnxruntime_DISABLE_CONTRIB_OPS"] = self.options.with_cuda_provider
tc.variables["onnxruntime_DISABLE_ML_OPS"] = False
tc.variables["onnxruntime_DISABLE_RTTI"] = False
tc.variables["onnxruntime_DISABLE_EXCEPTIONS"] = False
Expand Down
12 changes: 12 additions & 0 deletions recipes/onnxruntime/all/patches/1.14.1-0006-cuda-gsl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
index b051ff0be1..19ce4107de 100644
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -251,6 +251,7 @@ if(onnxruntime_USE_CUDA)
URL ${DEP_URL_microsoft_gsl}
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
+ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
)
else()
FetchContent_Declare(
12 changes: 12 additions & 0 deletions recipes/onnxruntime/all/patches/1.15.1-0002-cuda-gsl.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/cmake/external/onnxruntime_external_deps.cmake b/cmake/external/onnxruntime_external_deps.cmake
index 9effd1a2db..3284c35424 100644
--- a/cmake/external/onnxruntime_external_deps.cmake
+++ b/cmake/external/onnxruntime_external_deps.cmake
@@ -288,6 +288,7 @@ if(onnxruntime_USE_CUDA)
URL ${DEP_URL_microsoft_gsl}
URL_HASH SHA1=${DEP_SHA1_microsoft_gsl}
PATCH_COMMAND ${Patch_EXECUTABLE} --binary --ignore-whitespace -p1 < ${PROJECT_SOURCE_DIR}/patches/gsl/1064.patch
+ FIND_PACKAGE_ARGS 4.0 NAMES Microsoft.GSL
)
else()
FetchContent_Declare(

0 comments on commit b25f9ab

Please sign in to comment.