paddle使用fp16模式推理时报错ONNXRuntimeError无法加载libcublasLt.so.11类似错误

使用paddle训练好模型之后,运行推理服务,指定使用fp16模式时,会使用ONNXRuntime包,遇到报错信息:

[E:onnxruntime:Default, provider_bridge_ort.cc:1480 TryGetProviderInfo_CUDA] /onnxruntime_src/onnxruntime/core/session/provider_bridge_ort.cc:1193 onnxruntime::Provider& onnxruntime::ProviderLibrary::Get() [ONNXRuntimeError] : 1 : FAIL : Failed to load library libonnxruntime_providers_cuda.so with error: libcublasLt.so.11: cannot open shared object file: No such file or directory

...

AssertionError: The environment for GPU inference is not set properly. A possible cause is that you had installed both onnxruntime and onnxruntime-gpu. 
Please run the following commands to reinstall: 
1) pip uninstall -y onnxruntime onnxruntime-gpu 
2) pip install onnxruntime-gpu

按照最后的提示重新安装了onnxruntime-gpu依然无效。

大致意思是,找不到库文件libcublasLt.so,类似的报错还有可能是:libcublas.so,libcufft.so等,尝试查找这些文件:

find / -name libcublas.so.*
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcublas.so.12.0.2.224
/usr/local/cuda-12.0/targets/x86_64-linux/lib/libcublas.so.12
/usr/lib/x86_64-linux-gnu/libcublas.so.9.1
/usr/lib/x86_64-linux-gnu/libcublas.so.9.1.85
/usr/share/man/man7/libcublas.so.7.gz
/data1/anaconda3/envs/sg_ocrsys/lib/libcublas.so.10.0.130
/data1/anaconda3/envs/sg_ocrsys/lib/libcublas.so.10.0
/data1/anaconda3/envs/sg_dddd/lib/libcublas.so.10
/data1/anaconda3/envs/sg_dddd/lib/libcublas.so.10.2.2.89

可以看到有很多版本的库文件,但很明显我们的版本是libcublas.so.12,但是看报错中需要的版本是libcublas.so.11,这显然是版本不匹配啊,查看安装的onnxruntime-gpu的版本是1.16.1,查询官网后发现,onnxruntime-gpu最新版本就是1.16.1,但是即使是最新版本,也只支持到CUDA11.8。

onnxruntime-gpu与CUDA版本对应:

截至发文时间2023-11-2

所以,不用尝试了,想用onnxruntime,乖乖降级CUDA版本使用吧,降低CUDA版本到11.7后报错消失。

另外,官方对12.0的支持应该快出来了吧,微软是真的不给力啊,nvidia的CUDA已经到12.3了,他却连12都还没支持呢。

paddle使用fp16模式推理时报错ONNXRuntimeError无法加载libcublasLt.so.11类似错误

原文链接:https://beltxman.com/3954.html,若无特殊说明本站内容为 行星带 原创,未经同意禁止转载。

发表评论

您的电子邮箱地址不会被公开。

Scroll to top