配置SfMlearner运行环境
- Tensorflow-gpu CUDA CuDNN 版本对应号
1. 安装CUDA
- 下载地址:https://developer.nvidia.com/cuda-toolkit-archive
- 版本选择:CUDA10.0
- cuda10.0需要对应的vs 这里选择vs2017 在安装选项中勾选“C++桌面开发”即可
- 过程选择:自定义安装——全选——安装完成
- 这里亲测不用修改环境变量
2.安装CuDNN
- 下载地址:https://developer.nvidia.com/rdp/cudnn-archive 需要注册,推荐微信
- 版本选择:CuDNN7.4.3
- 解压压缩包,将bin,include,lib中的文件分别拷贝到对应的bin,include,lib目录中
3.测试
- 打开cmd命令行窗口输入nvcc -V,对CUDA是否完成安装进行检查:
- 依次打开下面目录的两个文件,检测到两个 result=pass 即为安装成功
4.安装tensorflow-gpu==1.13.1
pip install tensorflow-gpu==1.13.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
- 如果之前安装了TensorFlow的其他版本先卸载
pip uninstall tensorflow-gpu==1.2.1
5. 测试Tensorflow-gpu
import tensorflow as tf
import os
os.environ['TF_CPP_MIN_LOG_LEVEL']='2'
a = tf.constant(1.)
b = tf.constant(2.)
print(a+b)
print('GPU:', tf.test.is_gpu_available())
输出为:
Tensor("add_1:0", shape=(), dtype=float32)
GPU: True