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

本文详细记录了解决TensorFlow 2.3在安装和使用过程中遇到的CUDA库缺失问题,通过调整CUDA版本和手动下载DLL文件,最终实现了GPU加速的正常运行。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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.youkuaiyun.com/qq_22016915/article/details/105267552
  • 安装10.1+10.2参考 https://learnku.com/articles/40393
  • 直接装dll https://blog.youkuaiyun.com/qq_41999081/article/details/104515513
  • DLL ps://cn.dll-files.com/download/1d7955354884a9058e89bb8ea34415c9/cudart64_101.dll.html?c=SktCNWZLZkxRTG1Pemk1Y2hMUTBudz09
为了在Windows上安装ADB工具,你可以按照以下步骤进行操作: 1. 首先,下载ADB工具包并解压缩到你自定义的安装目录。你可以选择将其解压缩到任何你喜欢的位置。 2. 打开运行窗口,可以通过按下Win+R键来快速打开。在运行窗口中输入"sysdm.cpl"并按下回车键。 3. 在系统属性窗口中,选择"高级"选项卡,然后点击"环境变量"按钮。 4. 在环境变量窗口中,选择"系统变量"部分,并找到名为"Path"的变量。点击"编辑"按钮。 5. 在编辑环境变量窗口中,点击"新建"按钮,并将ADB工具的安装路径添加到新建的路径中。确保路径正确无误后,点击"确定"按钮。 6. 返回到桌面,打开命令提示符窗口。你可以通过按下Win+R键,然后输入"cmd"并按下回车键来快速打开命令提示符窗口。 7. 在命令提示符窗口中,输入"adb version"命令来验证ADB工具是否成功安装。如果显示版本信息,则表示安装成功。 这样,你就成功在Windows上安装了ADB工具。你可以使用ADB工具来执行各种操作,如枚举设备、进入/退出ADB终端、文件传输、运行命令、查看系统日志等。具体的操作方法可以参考ADB工具的官方文档或其他相关教程。\[1\]\[2\]\[3\] #### 引用[.reference_title] - *1* [windows环境安装adb驱动](https://blog.csdn.net/zx54633089/article/details/128533343)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* *3* [Windows下安装使用ADB,简单易懂教程](https://blog.csdn.net/m0_37777700/article/details/129836351)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 19
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值