diff --git a/cmake/onnxruntime_unittests.cmake b/cmake/onnxruntime_unittests.cmake index d098dc3591..9065f9725a 100644 --- a/cmake/onnxruntime_unittests.cmake +++ b/cmake/onnxruntime_unittests.cmake @@ -451,7 +451,7 @@ set(ONNXRUNTIME_TEST_LIBS onnxruntime_session ${ONNXRUNTIME_INTEROP_TEST_LIBS} ${onnxruntime_libs} - # CUDA, TENSORRT, DNNL, and OpenVINO are explicitly linked at runtime + # CUDA, TENSORRT, DNNL, and OpenVINO are dynamically loaded at runtime ${PROVIDERS_MIGRAPHX} ${PROVIDERS_NUPHAR} ${PROVIDERS_NNAPI} diff --git a/onnxruntime/core/framework/provider_bridge_ort.cc b/onnxruntime/core/framework/provider_bridge_ort.cc index d886e6e456..02280c4c5c 100644 --- a/onnxruntime/core/framework/provider_bridge_ort.cc +++ b/onnxruntime/core/framework/provider_bridge_ort.cc @@ -1071,13 +1071,13 @@ ORT_API_STATUS_IMPL(OrtSessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessi ORT_API_STATUS_IMPL(OrtApis::SetCurrentGpuDeviceId, _In_ int device_id) { if (auto* info = onnxruntime::GetProviderInfo_CUDA()) return info->SetCurrentGpuDeviceId(device_id); - return nullptr; + return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); } ORT_API_STATUS_IMPL(OrtApis::GetCurrentGpuDeviceId, _In_ int* device_id) { if (auto* info = onnxruntime::GetProviderInfo_CUDA()) return info->GetCurrentGpuDeviceId(device_id); - return nullptr; + return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); } ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_CUDA, _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options) { diff --git a/onnxruntime/core/session/onnxruntime_c_api.cc b/onnxruntime/core/session/onnxruntime_c_api.cc index 12174163e5..68485125b0 100644 --- a/onnxruntime/core/session/onnxruntime_c_api.cc +++ b/onnxruntime/core/session/onnxruntime_c_api.cc @@ -1819,25 +1819,6 @@ ORT_API_STATUS_IMPL(OrtApis::SessionGetProfilingStartTimeNs, _In_ const OrtSessi // End support for non-tensor types -#ifndef USE_CUDA -ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_CUDA, - _In_ OrtSessionOptions* options, _In_ const OrtCUDAProviderOptions* cuda_options) { - ORT_UNUSED_PARAMETER(options); - ORT_UNUSED_PARAMETER(cuda_options); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::SetCurrentGpuDeviceId, _In_ int device_id) { - ORT_UNUSED_PARAMETER(device_id); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} - -ORT_API_STATUS_IMPL(OrtApis::GetCurrentGpuDeviceId, _In_ int* device_id) { - ORT_UNUSED_PARAMETER(device_id); - return CreateStatus(ORT_FAIL, "CUDA execution provider is not enabled."); -} -#endif - #ifndef USE_ROCM ORT_API_STATUS_IMPL(OrtApis::SessionOptionsAppendExecutionProvider_ROCM, _In_ OrtSessionOptions* options, _In_ const OrtROCMProviderOptions* rocm_options) {