Centos configuration deep learning development environment

Posted by bsbotto on Sat, 04 Jan 2020 00:17:58 +0100

Catalog

1. Install the video card driver

  • Check the driver and model of the video card
$ sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
  • Add ELPepo source
$ sudo rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm
  • Install NVIDIA driver test
$ sudo yum install nvidia-detect
$ nvidia-detect -v
$ yum -y install kmod-nvidia

2. Install CUDA\CUDNN

2.1 cuda

  • To download cuda on the official website, it is better to download version 9.0: https://developer.nvidia.com/cuda-toolkit-archive
  • Select the settings that match your own machine, and select run file (local) to download to centos:
  • All patches need to be downloaded. After downloading, install cuda:
$ sudo sh cuda_9.0.176_384.81_linux.run
  • Test whether cuda is installed
$ cd /usr/local/cuda/samples/1_Utilities/deviceQuery
$ sudo make
$ ./deviceQuery

Result:

2.2 cudnn

  • To download the cudnn file, you need to register an account.
    https://developer.nvidia.com/cudnn
  • Install and download the installation package of cuDNN. If the directory where you install cuda is the default directory, you can directly use the following instructions to install:
tar -xvf cudnn-9.0-linux-x64-v7.1.tgz -C /usr/local/

2.3 environment variable setting

  • environment variable
$ vim ~/.bashrc
//Add at the end:
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda
  • cuDNN establish connection
$ cd /usr/local/cuda/lib64
$ sudo rm -rf libcudnn.so libcudnn.so.7         #Delete the original version number. The version number is queried in cudnn/lib64
$ sudo ln -s libcudnn.so.7.0.5 libcudnn.so.7    #Generate a soft connection, pay attention to the version number you downloaded
$ sudo ln -s libcudnn.so.7 libcudnn.so 
$ sudo ldconfig     #Immediate effect

3. Install tensorflow GPU

  • Install anaconda, which can be used to build some legacy environments for python3 and TensorFlow.
$ wget https://Repo.anaconda.com/archive/anaconda3-5.2.0-linux-x86 ﹐ 64.sh ﹐ download Anaconda
$ bash anaconda.sh      #Install anaconda
$ vim /root/.bashrc     #Add environment variable
    # Add the last line:
    export PATH="/root/anaconda3/bin:$PATH"
$ source /root/.bashrc
  • Install TensorFlow
pip install tensorflow-gpu

test

Input:

$ python
>>> import tensorflow

Show:

>>> import tensorflow
/root/anaconda3/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
>>> 

Error not reported, installation succeeded.

Please indicate the source of reprint.
https://www.cnblogs.com/sunhongwen/p/9554057.html

Topics: Linux sudo Anaconda RPM yum