安装NVIDIA CUDA Toolkit 8.0
cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64-rpm, cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.x86_64-rpm
mv cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64-rpm cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64.rpm
sudo rpm -ivh cuda-repo-rhel7-8-0-local-ga2-8.0.61-1.x86_64.rpm
mv cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.x86_64-rpm cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.x86_64.rpm
sudo rpm -ivh cuda-repo-rhel7-8-0-local-cublas-performance-update-8.0.61-1.x86_64.rpm
查询显卡状态
nvidia-smi
运行cuda sample
cd /usr/local/cuda/bin
./cuda-install-samples-8.0.sh /appcom/home/hadoop/
cd /appcom/home/hadoop/NVIDIA_CUDA-8.0_Samples/
make #这一步时间很长
./bin/x86_64/linux/release/deviceQuery
安装cuDNN
cudnn-8.0-linux-x64-v6.0.tgz
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*
安装Anaconda
sh Anaconda3-5.0.1-Linux-x86_64.sh
安装tensorflow python环境
conda create -n tensorflow python=3.6 --offline
启用tensorflow环境
source activate tensorflow
按照顺序安装一下python包依赖
install six-1.11.0-py2.py3-none-any.whl
pip install protobuf-3.5.0.post1-cp36-cp36m-manylinux1_x86_64.whl
pip install Werkzeug-0.13-py2.py3-none-any.whl
pip install enum34-1.1.6-py3-none-any.whl
pip install Markdown-2.6.10.zip
pip install webencodings-0.5.1-py2.py3-none-any.whl
pip install html5lib-0.9999999.tar.gz
pip install bleach-1.5.0-py2.py3-none-any.whl
pip install numpy-1.13.3.zip
pip install tensorflow_tensorboard-0.4.0rc3-py3-none-any.whl
pip install tensorflow_gpu-1.4.0-cp36-cp36m-linux_x86_64.whl (cpu版本:tensorflow-1.4.0-cp36-cp36m-linux_x86_64.whl)
测试tensorflow
python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
3.6的tensorflow有python3.5编译的模块,警告可以忽略
启动Session的时候可以看到已经使用了4颗K80 GPU
退出tensorflow环境
source deactivate