谷歌云GPU Tesla p100 只能安装cuda9.2版本以上
Step 1: Update and Upgrade your system
sudo apt-get update && sudo apt-get upgrade
Step 2: Verify You Have a CUDA-Capable GPU
lspci | grep -i nvidia
Step 3: Verify You Have a Supported Version of Linux
uname -m && cat /etc/*release
Step 4: Install Dependencies
确认安装python3.6
sudo apt-get install build-essential && sudo apt-get install cmake git unzip zip && sudo add-apt-repository ppa:deadsnakes/ppa && sudo apt-get update && sudo apt-get install pylint
Step 5: Install linux kernel header
uname -r
You can get like “4.10.0-42-generic”. Note down linux kernel version. To install linux header supported by your linux kernel do following:
sudo apt-get install linux-image-extra-virtual
sudo apt-get install linux-source
sudo apt-get source linux-image-$(uname -r)
sudo apt-get install linux-headers-$(uname -r)
Step 6: Install NVIDIA CUDA 9.2
rm old version
sudo apt-get purge nvidia* && sudo apt-get autoremove && sudo apt-get autoclean && sudo rm -rf /usr/local/cuda*
本地运行:
rsync -avhP cuda_9.2.148_396.37_linux.run topppsen@35.201.161.49:/home/topppsen
rsync -avhP cudnn-9.2-linux-x64-v7.4.1.5.tgz topppsen@35.201.161.49:/home/topppsen
服务器运行
sudo sh cuda_9.2.148_396.37_linux.run --override --no-opengl-lib --kernel-source-path=/usr/src/linux-headers-$(uname -r)/
linux-headers-4.15.0-1024-gcp为uname -r所得
注意: 安装过程中,不要选择OpenGL,否则会出现,循环进入登录界面 ,本人选择安装 CUDA Samples(建议安装,待会会借助它查看是否安装成功,及显卡信息),并安装在 Documents 文件夹下。
重启服务器使cuda生效
添加环境变量:
echo 'export PATH=/usr/local/cuda-9.2/bin${PATH:+:${PATH}}' >> ~/.bashrc && echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}' >> ~/.bashrc && source ~/.bashrc
Check driver version probably Driver Version: 396.26
sudo ldconfig && nvidia-smi
终端进入你的 CUDA Samples安装目录,执行编译后运行 ./deviceQuery 输出显卡设备等信息。
cd NVIDIA_CUDA-9.2_Samples/1_Utilities/deviceQuery && make && ./deviceQuery
step 6: install CUDNN
将cudnn 安装文件上传到服务器,上面已经完成
进入服务器主目录解压
tar zxvf cudnn-9.2-linux-x64-v7.4.1.5.tgz
解压后,在你的目录下生成了一个“cuda”文件夹,对于cuDNN6.0的版本解压后生成“cudnn-8.0-linux-x64-v6.0”文件。使用如下命令copy,注意第二个有个-a参数,否则,拷贝过去的文件失去了链接。
copy the library files into CUDA's include and lib folders
sudo cp -R cuda/include/* /usr/local/cuda-9.2/include && sudo cp -R cuda/lib64/* /usr/local/cuda-9.2/lib64
step 7: Tensorflow gpu install 见参考2 从step11开始
参考:
1.Ubuntu 16.04 LTS + CUDA8.0 + cudnn6.0
2.How to install Tensorflow GPU with CUDA 9.2 for python on Ubuntu
3.cuda_install_github
网友评论