Windows10 安装Tensorflow2.3.0-gpu 踩坑记

作者: print("") 分类: 未分类 发布时间: 2020-09-24 21:25

上一节已经安装了CPU 的Tensorflow 。

这节为了安装GPU 的方式

这里是首先需要一张英伟达的显卡。我本机使用的是GTX950M (2G) 垃圾显卡

首先下载cuda

链接:https://pan.baidu.com/s/1ng9XEKdhO_BuGOucecwYjA 
提取码:cvf4

一、安装CUDA

将下载的cuda_10.0.130_411.31_win10.exe 双击

安装完之后。查看是否安装成功

1、查看nvcc.exe

查看cupti64_100.dll

3、配置cudnn

把百度云下载的cudnn-10.0-windows10-x64-v7.5.0.56 (1).zip文件进行解压

重命名为cudnn 放到C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\ 目录中

二、设置环境变量

三、安装tensorflow-gpu

四、测试

>>> import tensorflow
2020-09-24 21:36:58.690379: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-09-24 21:36:58.695352: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

发现引用错误。故到安装目录进行搜索

尝试复制一个变成101 试试

再次尝试

>>> tf.test.is_gpu_available()
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-09-24 21:40:33.327771: 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-24 21:40:33.351626: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1ea43e8f260 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-09-24 21:40:33.358441: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-09-24 21:40:33.367019: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2020-09-24 21:40:34.166517: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 950M computeCapability: 5.0
coreClock: 1.124GHz coreCount: 5 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 29.83GiB/s
2020-09-24 21:40:34.175047: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2020-09-24 21:40:34.184106: 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-24 21:40:34.200566: 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-24 21:40:34.215799: 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-24 21:40:34.230730: 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-24 21:40:34.245331: 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-24 21:40:34.269550: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2020-09-24 21:40:34.277842: 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-24 21:40:34.863658: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-09-24 21:40:34.871864: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]      0
2020-09-24 21:40:34.879288: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:   N
2020-09-24 21:40:34.893831: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1ea44826ef0 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-09-24 21:40:34.904479: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): GeForce GTX 950M, Compute Capability 5.0

还是出现问题。

还是缺少Dll

链接:https://pan.baidu.com/s/1L_70UMfO75jj1DseXFyF8g 
提取码:6brn

下载如上的dll 复制到安装目录中

重新进行测试

成功引用成功

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

发表评论

电子邮件地址不会被公开。 必填项已用*标注