Alibaba Cloud GPU server:

In order to avoid pitfalls, the automatic installation of the GPU driver is selected by default, and the version is 390.46 under 9.0.176;

ps: This was chosen when I placed a single order to select the operating system. Later, when I was planning to reinstall the system, I found that the reinstallation did not include the driver selection step, so I gave up and did not reinstall. I don’t know if I will install it if I submit a work order for the reinstallation; after the system is activated Once you go in, you can see the log file of the driver installation, and that’s it if it’s successful;

system update:

yum update

Update Python3, refer to https://cucldk.com/post/centos7-to-python3.html

https://developer.nvidia.com/cudnnDownload cuDNN from the official website, you need to register an account to log in, download version Download cuDNN v7.3.1 (Sept 28, 2018), for cuDNN v7 under CUDA 9.0 .3.1 Library for Linux;

Domestic downloads of foreign websites may be slow, so if you are in a hurry, you can use a foreign VPS to transfer them;

tar -zxvf cudnn-9.0-linux-x64-v7.3.1.20.tgz
cd cuda
cp include/* /usr/local/cuda-9.0/inlcude
cp lib64/lib* /usr/local/cuda-9.0/lib64

Modify environment variables and execute 

sudo vim /etc/profile

Add two lines of code below the export PATH line:

export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH

Exit execution

source /etc/profile
pip3 install tensorflow-gpu==1.12.0

Execute the test code to see if it can be imported normally and output customized text:

import tensorflow as tf

hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
sess.run(hello)

execute after

from tensorflow.python.client import device_lib
print(device_lib.list_local_devices())

Success occurs when the gpu is detected.

Reference editor: https://blog.csdn.net/Oh_My_Fish/article/details/78861867



Leave a Reply