安装tensorflow-gpu

win10+anaconda虚拟环境安装tensorflow-gpu步骤

安装anaconda3,版本稳定,python3.7.3

对应关系tensorflow-gpu2.1.0+cuDNN7.4+CUDA10.1

由于之前安装的CUDA是10.2的现在重新安装太麻烦就直接改版本号
方法:
1、将CUDA安装目录下的 D:\cudnn-10.2-windows10-x64-v7.6.5.32\cuda\bin\cudart64_102.dll 在所在目录下复制一份,更名为cudart64_101.dll
在这里插入图片描述
2、将CUDA安装目录下的(已经安装好cuDNN了)E:\cuda\v10.2\cudnn\bin\cudnn64_8,复制一份到E:\cuda\v10.2\bin目录下,并更名为cudnn64_7.dll

创建虚拟环境

conda create -n tensorflow-gpu python==3.7

激活虚拟环境

activate tensorflow-gpu

安装tensorflow (如果有GPU此步可不用安装)

conda install tensorflow==2.1.0

安装tensorflow-gpu

conda install tensorflow-gpu==2.1.0

安装完毕,测试gpu是否成功:

import tensorflow as tf

测试:

import tensorflow as tf
print(tf.test.is_gpu_available())

2023-11-23 09:55:43.709821: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
WARNING:tensorflow:From <input>:2: 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.
2023-11-23 09:55:46.594352: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2023-11-23 09:55:46.598213: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2023-11-23 09:55:46.646740: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties: 
pciBusID: 0000:01:00.0 name: GeForce GTX 1650 with Max-Q Design computeCapability: 7.5
coreClock: 1.35GHz coreCount: 14 deviceMemorySize: 4.00GiB deviceMemoryBandwidth: 149.04GiB/s
2023-11-23 09:55:46.647068: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2023-11-23 09:55:47.214442: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2023-11-23 09:55:47.307430: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2023-11-23 09:55:47.349768: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2023-11-23 09:55:47.685856: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2023-11-23 09:55:48.018950: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2023-11-23 09:55:48.355869: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2023-11-23 09:55:48.356109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0
2023-11-23 09:55:50.484168: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2023-11-23 09:55:50.484315: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102]      0 
2023-11-23 09:55:50.484413: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0:   N 
2023-11-23 09:55:50.485025: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/device:GPU:0 with 2919 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1650 with Max-Q Design, pci bus id: 0000:01:00.0, compute capability: 7.5)
True

返回True

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

全糖去冰_q

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值