配置X11 (在安装驱动的时候有自动执行 nvidia-xconfig 选项, 如果选yes可以确定跳过此步骤)
# nvidia-xconfig WARNING: Unable to locate/open X configuration file. New X configuration file written to '/etc/X11/xorg.conf'启动图形界面
# systemctl enable gdm Created symlink from /etc/systemd/system/display-manager.service to /usr/lib/systemd/system/gdm.service. # reboot验证
执行命令查看显卡状态
# nvidia-smi
在页面右上角的 应用程序-> 其他 -> Nvidia 选项中,有如下 GPU 0 选项,说明安装成功(找的样图,型号和驱动不同)
【注】: 如果中途有问题, 可以执行 ./NVIDIA-Linux-x86_64-384.69.run --uninstall 进行卸载.
3.安装cuda【cuda-8.0驱动下载】 【cuda-8.0补丁下载】 【其他版本驱动下载】
科普下cuda,简单来说就是能使用GPU并行计算的平台和编程模型,能极大提升计算性能。
Q: What is CUDA?
CUDA® is a parallel computing platform and programming model that enables dramatic increases in computing performance by harnessing the power of the graphics processing unit (GPU).
Since its introduction in 2006, CUDA has been widely deployed through thousands of applications and published research papers, and supported by an installed base of hundreds of millions of CUDA-enabled GPUs in notebooks, workstations, compute clusters and supercomputers. Applications used in astronomy, biology, chemistry, physics, data mining, manufacturing, finance, and other computationally intense fields are increasing using CUDA to deliver the benefits of GPU acceleration.
再次进入text mode
# init 3
安装依赖库:
# yum -y install gcc-c++ # yum -y install epel-release # yum -y install --enablerepo=epel dkms # yum -y install kernel-devel-$(uname -r) kernel-headers-$(uname -r)
安装cuda-8.0驱动(一定注意下图安装过程中的红框部分,跳过安装NVIDIA驱动的步骤(输入n)):
# ./cuda_8.0.61_375.26_linux-run
安装cuda补丁
# ./cuda_8.0.61.2_linux-run
设置环境变量
# vim /etc/profile最后一行添加
export PATH="/usr/local/cuda-8.0/bin:$PATH" export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib64" export CUDA_HOME="/usr/local/cuda"使之生效
# source /etc/profile 4.安装cuDNN科普下cudnn,简单点说cuDNN是NVIDIA深度学习中的深层神经网络库,并通过cuda,我们就可以直接利用Nvidia GPU的并行计算能力进行深度学习训练任务了。
The NVIDIA CUDA® Deep Neural Network library (cuDNN) is a GPU-accelerated library of primitives for deep neural networks. cuDNN provides highly tuned implementations for standard routines such as forward and backward convolution, pooling, normalization, and activation layers. cuDNN is part of the NVIDIA Deep Learning SDK.
下载cudnn-8.0-linux-x64-v6.0.tgz
下载cuDNN,需要创建一个NVIDIA账号,cuDNN Home Page.
不想注册的话,可以通过如下方式获取
wget
解压并拷贝相关文件,完成安装
# tar -xzvf cudnn-8.0-linux-x64-v6.0.tgz # sudo cp cuda/include/cudnn.h /usr/local/cuda/include # sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64 # sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn* 三、python 3.6.2编译安装及配置 1.安装依赖库 yum install gcc-c++ sqlite-devel gcc zlib zlib-devel bzip2-devel openssl-devel ncurses-devel tcl tcl-devel tk tk-devel 2.安装Python3【python-3.6.2 源码下载】
将python 源码放置到一个无害的目录,执行命令:
# sudo mkdir /usr/local/python3 # tar -xzvf Python-3.6.2.tgz # cd Python-3.6.2 # 进入解压目录 # sudo ./configure --prefix=/usr/local/python3 --enable-optimizations # 指定创建的目录修改Setup文件
vim Modules/Setup修改结果如下(将行开头的注释“#”去掉):
# Socket module helper for socket(2) _socket socketmodule.c # Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: #SSL=/usr/local/ssl _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto编译安装(时间较长,耐心等待)
sudo make sudo make install 3.与Python 2.7.5 共存创建链接python3,这样就可以通过 python 命令使用 Python 2,python3 来使用 Python 3。
sudo ln -s /usr/local/python3/bin/python3 /usr/bin/python3安装 pip
sudo ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3