cudnn7.5.0软链接
sudo cp lib* /usr/local/cuda/lib64/ #复制动态链接库
cd /usr/local/cuda/lib64/
sudo rm -rf libcudnn.so libcudnn.so.7 #删除原有动态文件
sudo ln -s libcudnn.so.7.5.0 libcudnn.so.7 #生成软衔接(注意这里要和自己下载的cudnn版本对应,可以在/usr/local/cuda/lib64下查看自己libcudnn的版本)
sudo ln -s libcudnn.so.7 libcudnn.so #生成软链接
查看cuda、cudnn方法:终端输入
cuda 版本
cat /usr/local/cuda/version.txt
cudnn 版本
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
安装tensorflow 1.8.0
cuda 9.0 + cunn7.5.0 + tensorflow1.8
sudo pip3 install tensorflow-gpu==1.18
SciPy报错
imread is depreciated after version 1.2.0! So to solve this issue I had to install version 1.1.0.
imsave
is deprecated in SciPy 1.0.0, and will be removed in 1.2.0.
试用如下代码检查是否有GPU可以被使用:
import os
from tensorflow.python.client import device_lib
os.environ["TF_CPP_MIN_LOG_LEVEL"] = "99"
if __name__ == "__main__":
print(device_lib.list_local_devices())
[name: "/device:CPU:0"
device_type: "CPU"
memory_limit: 268435456
locality {
}
incarnation: 13093582915275020871
, name: "/device:XLA_GPU:0"
device_type: "XLA_GPU"
memory_limit: 17179869184
locality {
}
incarnation: 4524363026150779068
physical_device_desc: "device: XLA_GPU device"
, name: "/device:XLA_CPU:0"
device_type: "XLA_CPU"
memory_limit: 17179869184
locality {
}
incarnation: 5553375378045819083
physical_device_desc: "device: XLA_CPU device"
]
命令: nvidia-smi
功能:显示机器上gpu的情况
命令: nvidia-smi -l
功能:定时更新显示机器上gpu的情况
命令:watch -n 0 nvidia-smi
功能:设定刷新时间(秒)显示GPU使用情况
查看温度
查看GPU的温度
nvidia-smi -q -i 0 -d TEMPERATURE
实时监控GPU的温度
watch -n 0.5 nvidia-smi -q -i 0 -d TEMPERATURE