Ai /post/tech/z… The author of this article Jinkey (wechat public account Jinkey-love, official website Jinkey.ai) article allows non-tampering with the attribution of reprint, delete or modify this section of copyright information reprint, as infringement of intellectual property rights, we reserve the right to pursue your legal liability, hereby declare!

preface

Run nvidia-dig-driver-local-repo-rhel7-384.81-1.0-1.x86_64. RPM Nvidia-linux-x86_64-384.81. run nvidia-dig-driver-local-repo-rhel7-384.81-1.0-1.x86_64 Cuda – ’08 – rhel7 9.0.176-1. X86_64. RPM cudnn – 9.0 – Linux – x64 – v7 tensorflow_gpu 1.4.0 – cp27 – none – linux_x86_64. WHL

Buying a server

Login console, cloud server – cloud host – region to choose “Beijing” – new, tuhao can choose monthly oh

Configuration is shown in figure





SSH [email protected]Copy the code

Once logged in, look at the input

cat /proc/versionCopy the code

Check your Linux version, enterprise cloud is using

Linux Version 3.10.0-693.5.2.el7.x86_64 ([email protected]) (GCC version 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC) ) #1 SMP Fri Oct 20 20:32:50 UTC 2017

So I’ll download the Red Hat version of all the dependencies for this tutorial

image.png


Download the dependent

Dependencies can be directly downloaded to the host using WGET, or downloaded to a PC and uploaded using XFTP (Windows) or Filezilla (Mac).

Download the NVIDIA driver www.nvidia.com/Download/Fi…

NVIDIA drivers

Here is Red Hat version download address cn.download.nvidia.com/tesla/384.8…

Download the CUDA developer.nvidia.com/cuda-downlo…

CUDA


Here is Red Hat version download address developer.download.nvidia.com/compute/cud…

Download cuDNN developer.nvidia.com/rdp/cudnn-d… (Download after registration and filling in the questionnaire)

cuDNN

Give a general Linux version download address developer.nvidia.com/compute/mac here…

Install the NVIDIA driver

Method 1 (the official recommended method) Provides the installation method on the download page. The installation method varies with OS versions


Please replace the file name with the same file name as when you downloaded the dependency, public id Jinkey-loveRPM -i nvidia-dig-driver-local-repo-rhel7-384.81-1.0-1.x86_64. RPM yum clean all yum install cuda-drivers rebootCopy the code

Method 2 (Extreme Lazy Version)

Install the Development Tools package
sudo yum update
sudo yum group install 'Development Tools'
Install the elrepo source
sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
Detect packages to install
sudo yum install nvidia-detect
nvidia-detect
# installation
sudo yum install kmod-nvidiaCopy the code

Install the CUDA

The installation method is described on the download page. The installation method varies according to the system version. The following uses RH as an example:

Please replace the file name with the same file name as when you downloaded the dependency, public id Jinkey-loveSudo RPM -i cuda-repo-rhel7-9.0.176-1.x86_64. RPM sudo yum clean all sudo yum install cudaCopy the code

Add CUDA to the environment variable

vim ~/.bash_profileCopy the code

join

export LD_LIBRARY_PATH=”$LD_LIBRARY_PATH:/usr/local/cuda/lib64″

export CUDA_HOME=/usr/local/cuda

To avoid ImportError: libcublas.so.8.0: importterror: libcublas.8.0: Importterror: libcublas.so.8.0: cannot open shared object file: “No such file or directory error”, you can use CUDA8.0 first (CUDA 9.0 will be installed at the same time, so you don’t need to reinstall CUDA8.0).

Export LD_LIBRARY_PATH = “$LD_LIBRARY_PATH: / usr/local/lib64 / cuda 8.0” export CUDA_HOME = / usr/local/cuda – 8.0

Install cuDNN

Please replace the file name with the same file name as when you downloaded the dependency, public id Jinkey-loveTar -xzvf cudnn-9.0-linux-x64-v7-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.hCopy the code

Installing Python dependencies

Penguin Cloud comes with Python 2.7

# installation PIP
sudo yum install python-pip python-devel
sudo pip install --upgrade pipCopy the code

Install Tensorflow

PIP install tensorflow — gpu –upgrade

Install matplotlib

sudo yum install freetype-devel
# Jinkey-love, official website jinkey.ai
sudo yum install libpng-devel
sudo pip install matplotlibCopy the code

Install Keras

Keras encapsulates Theano and Tensorflow’s highly modular deep learning library, perfect for beginners.

sudo pip install keras --upgradeCopy the code

The default back end of Keras is Theano so we’ll change it to Tensorflow

vim .keras/keras.jsonCopy the code

Modified to

{
    "image_dim_ordering": "tf"."epsilon": 1e-07."floatx": "float32"."backend": "tensorflow"
}Copy the code

complete

Under the same project, GPU training speed is 187 times faster than CPU training. If you find the tutorial useful, you can send me a reward on wechat

The resources

Install ImportError: libcublas.so.8.0