diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index cd586f22c6..c0ccab69ee 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -724,12 +724,13 @@ if (onnxruntime_USE_CUDA) if (WIN32) link_directories(${onnxruntime_CUDNN_HOME}/lib/x64) - file(GLOB cuda_dll_paths "${onnxruntime_CUDA_HOME}/bin/cublas64_*" "${onnxruntime_CUDA_HOME}/bin/cudart64_*" "${onnxruntime_CUDA_HOME}/bin/curand64_*") - set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:cudnn64_7.dll") - foreach(cuda_dll_path ${cuda_dll_paths}) - get_filename_component(cuda_dll_file_name ${cuda_dll_path} NAME) - set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:${cuda_dll_file_name}") - endforeach(cuda_dll_path) + # delayload causes crash on exit, so disable for now + #file(GLOB cuda_dll_paths "${onnxruntime_CUDA_HOME}/bin/cublas64_*" "${onnxruntime_CUDA_HOME}/bin/cudart64_*" "${onnxruntime_CUDA_HOME}/bin/curand64_*") + #set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:cudnn64_7.dll") + #foreach(cuda_dll_path ${cuda_dll_paths}) + # get_filename_component(cuda_dll_file_name ${cuda_dll_path} NAME) + # set(onnxruntime_DELAYLOAD_FLAGS "${onnxruntime_DELAYLOAD_FLAGS} /DELAYLOAD:${cuda_dll_file_name}") + #endforeach(cuda_dll_path) else() link_directories(${onnxruntime_CUDNN_HOME}/lib64) diff --git a/onnxruntime/test/shared_lib/test_model_loading.cc b/onnxruntime/test/shared_lib/test_model_loading.cc index ee51301676..b3f88fc2af 100644 --- a/onnxruntime/test/shared_lib/test_model_loading.cc +++ b/onnxruntime/test/shared_lib/test_model_loading.cc @@ -2,6 +2,9 @@ // Licensed under the MIT License. #include "core/session/onnxruntime_cxx_api.h" +#ifdef USE_CUDA +#include "core/providers/cuda/cuda_provider_factory.h" +#endif #include #include "test_fixture.h" #include "file_util.h" @@ -25,6 +28,12 @@ TEST(CApiTest, model_from_array) { Ort::SessionOptions so; Ort::Session session(*ort_env.get(), buffer.data(), buffer.size(), so); + +#ifdef USE_CUDA + // test with CUDA provider when using onnxruntime as dll + Ort::ThrowOnError(OrtSessionOptionsAppendExecutionProvider_CUDA(so, 0)); + Ort::Session session_cuda(*ort_env.get(), buffer.data(), buffer.size(), so); +#endif } } // namespace test } // namespace onnxruntime