microsoft / onnxruntime

ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
https://onnxruntime.ai
MIT License
14.69k stars 2.93k forks source link

FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\code\Blueprint.Net.Server\bin\Debug\net8.0-windows10.0.22621.0\runtimes\win-x64\native\onnxruntime_providers_cuda.dll" ” #21436

Open anan1213095357 opened 3 months ago

anan1213095357 commented 3 months ago

Describe the issue

1721617468489

image

1721617633987 1721617694068 1721617759622 1721617830984 1721617874579

Urgency

No response

Target platform

w11

Build script

null

Error / output

Microsoft.ML.OnnxRuntime.OnnxRuntimeException:“[ErrorCode:RuntimeException] C:\a_work\1\s\onnxruntime\core\session\provider_bridge_ort.cc:1426 onnxruntime::ProviderLibrary::Get [ONNXRuntimeError] : 1 : FAIL : LoadLibrary failed with error 126 "" when trying to load "C:\code\Blueprint.Net.Server\bin\Debug\net8.0-windows10.0.22621.0\runtimes\win-x64\native\onnxruntime_providers_cuda.dll" ”

Visual Studio Version

No response

GCC / Compiler Version

No response

tianleiwu commented 3 months ago

You can use Dependency Walker to see the required DLLs for onnxruntime_providers_cuda.dll. 1.18.1 requires installation of CUDA 11.8 + CuDNN 8.9 + Latest VC Runtime, or CUDA 12.x + cuDNN 9 + Latest VC Runtime. Example could be like: image

See https://stackoverflow.com/questions/7378959/how-to-check-for-dll-dependency.

If you are not sure whether it is PATH setting problem, just copy those dependent DLLs (except API-*.dll) to the same directory of onnxruntime_providers_cuda.dll to verify.

skottmckay commented 3 months ago

You need to follow the cuDNN install instructions closely for the specific cuDNN version. The instructions change semi-regularly. Often the zlibwapi.dll library is overlooked.

e.g. for cuDNN 8.9: https://docs.nvidia.com/deeplearning/cudnn/archives/cudnn-890/install-guide/index.html#install-windows

Make sure the PATH value in the environment the app is running in is as expected.

Dlls loaded manually at runtime won't show up in Dependency Walker (or Dependencies), so while that's a good place to start, it may not be comprehensive.

The ORT CUDA library links against cudnn64_8.dll, but that has minimal dependencies listed, so most likely it loads things like cudnn_cnn_infer64_8.dll manually at runtime as/when needed. cudnn_cnn_infer64_8.dll requires zlibwapi.dll.

github-actions[bot] commented 2 months ago

This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.