TensorFlow GPU版本安装(1):cudn8.0安装

来源:互联网 发布:淘宝开店卖景点门票 编辑:程序博客网 时间:2024/05/16 04:42

一、安装预检测

1.1 检查显卡类型

lspci | grep -i nvidia

03:00.0 3D controller: NVIDIA Corporation GK110BGL [Tesla K40m](rev a1)

查看是否为支持显卡:http://developer.nvidia.com/cuda-gpus

1.2 检查操作系统类型

uname -m && cat /etc/*release

 

x86_64

NAME="Red Hat Enterprise LinuxServer"

VERSION="7.2 (Maipo)"

1.3 检查gcc版本

gcc –version

gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

1.4 检测kernel headers anddevelopment packages

uname -r

3.10.0-327.el7.x86_64

 

RHEL安装:

sudo yum install kernel-devel-$(uname -r)kernel-headers-$(uname -r)

二 、安装

下载地址:http://developer.nvidia.com/cuda-downloads.

2.1 关闭Nouveau drivers

检测该驱动是否在使用:

lsmod | grep nouveau

有输出表示在使用

RHEL中如何屏蔽:

创建 /etc/modprobe.d/blacklist-nouveau.conf 加入如下内容:

blacklist nouveau

options nouveau modeset=0

 

重新创建kernel initramfs

sudo dracut –force

 

2.2 设置文本模式

RHEL6和RHEL7的设置有区别,具体参见/etc/inittab文件

RHEL7的设置:

systemctl set-default multi-user.target

reboot

 

systemctl get-default

multi-user.target

 

安装:

sudo sh cuda_8.0.61_375.26_linux.run

安装升级补丁:

sudo sh cuda_8.0.61.2_linux.run

2.3 错误解决

ERROR: You appear to be running an Xserver; please exit X before

 

      installing.  For further details,please see the section INSTALLING

 

       THE NVIDIA DRIVER in the README availableon the Linux driver

 

      download page at www.nvidia.com.

So make sure you're killing X via stoppinglightdm (try gdm too, just to be sure) before the CUDA 5.0 test:

`sudo service lightdm stop`

`sudo service gdm stop`

 

Then try the test again. If it stillmentions the X file, see if you have X running with:

`ps aux | grep X`

This might shed some insight.

 

If X is not running, delete the lockfile(s)

`sudo rm /tmp/.X*-lock`

三、安装后验证

3.1 环境设置

export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}

export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

3.2 测试程序

服务器未安装g++需要先安装:

yum install gcc-c++.x86_64

 

打开~/NVIDIA_CUDA-8.0_Samples,执行make

编译成功,会在/root /NVIDIA_CUDA-8.0_Samples/bin/x86_64/linux/release中找到编译完的程序:

如执行./deviceQuery

会输出相应信息

四、卸载

卸载CudA

sudo /usr/local/cuda-8.0/bin/uninstall_cuda_8.0.pl

 

卸载NVIDIA驱动

sudo /usr/bin/nvidia-uninstall

 

去除对于Nouveau驱动的屏蔽,重新生成kernel initramfs/initrd

原创粉丝点击