解决Tensorflow:Could not load dynamic library ‘cudart64_101.dll‘;dynamic library ‘cublas64_10.dll‘;

Introduce

Tensorflow: 2.3.0
Cuda: 10.2
VS Code
之前有装pytorch的过程,但是不少文章的模型用的tensrflow。。就是就pip install tsnsorflow下载了该package,在运行环境测试代码的时候报错缺少dll

2020-09-06 09:45:01.361802: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found  
2020-09-06 09:45:01.367980: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-09-06 09:45:01.381555: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-09-06 09:45:01.397029: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-09-06 09:45:01.411172: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-09-06 09:45:01.427179: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-09-06 09:45:01.431474: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are 
installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-09-06 09:45:01.460437: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-09-06 09:45:01.493733: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1a5bb817dd0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-06 09:45:01.498652: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-09-06 09:45:01.510107: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-09-06 09:45:01.513734: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]
tf.Tensor(10.0, shape=(), dtype=float32)

Only DLL Method

看了些帖子说tf2.3需要cuda10.1.。。。10.2和10.0都不好使。。。于是要装回10.1.。。are u kidding me???下个旧版的而且不支持新版???一个10.1就2.5g。。。还要装10.2的那个我还没有试过

于是我就想着吧,既然确实dll,那我直接下载dll不就行了吗,于是我下载了cudart64_101.dll,按照别的帖子说的路径“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.x\bin”,问题在于我的cuda 10.2没有发现NVIDIA GPU Computing Toolkit这个文件夹。。。于是我把这个刚下载的ll放在了C:\Windows\System32,重新运行了示例程序,Yes!!
在这里插入图片描述
这里附上下载链接

cufft64_10.dll
curand64_10.dll
cusolver64_10.dll

  • cusparse64_10.dll
  • cudnn64_7.dll
    有好几个dll没找到。。。。运行之后就是这个结果。。。还有几个dll没整到。。。于是找了一翻在n家官网发现了这个10.2 toolkit
    安装之后在运行还是。。。。。心累
2020-09-06 10:44:39.412824: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-06 10:44:42.847854: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-09-06 10:44:42.874234: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 
pciBusID: 0000:06:00.0 name: GeForce GTX 750 Ti computeCapability: 5.0
coreClock: 1.189GHz coreCount: 5 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 80.47GiB/s
2020-09-06 10:44:42.883963: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-06 10:44:42.890574: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-09-06 10:44:42.896611: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-09-06 10:44:42.915975: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-09-06 10:44:42.923068: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-09-06 10:44:42.930074: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2020-09-06 10:44:42.945912: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-09-06 10:44:42.958982: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2020-09-06 10:44:42.979756: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations:  AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2020-09-06 10:44:43.020581: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x246feabe770 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-06 10:44:43.026014: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-09-06 10:44:43.029846: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-09-06 10:44:43.043218: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]
tf.Tensor(10.0, shape=(), dtype=float32)

最后一招

打开我的Anaconda的Tensorflow环境,运行就出来了。。。。。
在这里插入图片描述

References

  • cuda10.1下载 https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal
  • 安装10.1参考 https://blog.csdn.net/qq_22016915/article/details/105267552
  • 安装10.1+10.2参考 https://learnku.com/articles/40393
  • 直接装dll https://blog.csdn.net/qq_41999081/article/details/104515513
  • DLL ps://cn.dll-files.com/download/1d7955354884a9058e89bb8ea34415c9/cudart64_101.dll.html?c=SktCNWZLZkxRTG1Pemk1Y2hMUTBudz09

猜你喜欢

转载自blog.csdn.net/weixin_43031092/article/details/108428238