9.安装NVIDIA驱动
安装NVIDIA驱动是很重要的步骤,该步成功了,后面也就基本上一马平川了。$ sudo sh NVIDIAxxx --kernel-source-path=/usr/src/kernels/x.xx.x-xxxxx
[littlebei@localhost ~]$ uname -r
3.10.0-693.2.2.el7.x86_64
The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are
installed and set up correctly.
If you know that the kernel source packages are installed and set up correctly, you may pass the location of thekernel source with the '--kernel-source-path' flag.
$ sudo yum install epel-release
$ sudo yum install --enablerepo=epel dkms
ERROR: Unable to load the 'nvidia-drm' kernel module.
One probable reason is that the system is boot from UEFI but Secure Boot option is turned on in the BIOS setting.
Turn it off and the problem will be solved.
这也就是为什么在第一步中我让大家关掉UEFI的原因了。
$ sudo sh cuda_8.0.61_375.26_linux.run
# accept
-------------------------------------------------------------
Do you accept the previously read EULA?accept/decline/quit: accept
# no
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?(y)es/(n)o/(q)uit: n
-------------------------------------------------------------
# 后面的就都选yes或者default
Do you want to install the OpenGL libraries?
(y)es/(n)o/(q)uit [ default is yes ]:
Do you want to run nvidia-xconfig?
This will update the system X configuration file so that the NVIDIA X driver is used.
The pre-existing X configuration file will be backed up.
This option should not be used on systems that require a custom X configuration,
such as systems with multiple GPU vendors.
(y)es/(n)o/(q)uit [ default is no ]: y
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y
Enter Toolkit Location [ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y
Enter CUDA Samples Location
[ default is /root ]:
Installing the NVIDIA display driver...
The driver installation has failed due to an unknown error. Please consult the driver
installation log located at /var/log/nvidia-installer.log.
===========
= Summary =
===========
Driver: Not Selected
Toolkit: Installed in /usr/local/cuda-8.0
Samples: Installed in /root, but missing recommended libraries
Please make sure that
- PATH includes /usr/local/cuda-8.0/bin
- LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or,
add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed
information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver.
A driver of version at least 361.00 is required for CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command,
replacing with the name of this run file:
sudo .run -silent -driver
Logfile is /tmp/cuda_install_192.log
$ sudo vim ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:/usr/local/cuda-8.0/extras/CUPTI/lib64:$LD_LIBRARY_PATH
export CUDA_HOME=/usr/local/cuda-8.0/
$ tar -xvzf cudnn-8.0-linux-x64-v6.0.tgz
$ cp include/* /usr/local/cuda/include
$ cp lib64/* /usr/local/cuda/lib64
$ sudo pip install tensorflow-gpu
Python 2.7.5 (default, Jun 17 2014, 18:11:42)
[GCC 4.8.2 20140120 (Red Hat 4.8.2-16)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> hello = tf.constant('Hello, TensorFlow!')
>>> sess = tf.Session()
2017-06-28 16:42:53.518877: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use SSE4.1 instructions,
but these are available on your machine and could speed up CPU computations.
2017-06-28 16:42:53.518906: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use SSE4.2 instructions,
but these are available on your machine and could speed up CPU computations.
2017-06-28 16:42:53.518914: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use AVX instructions,
but these are available on your machine and could speed up CPU computations.
2017-06-28 16:42:53.518921: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use AVX2 instructions,
but these are available on your machine and could speed up CPU computations.
2017-06-28 16:42:53.518929: W tensorflow/core/platform/cpu_feature_guard.cc:45]
The TensorFlow library wasn't compiled to use FMA instructions,
but these are available on your machine and could speed up CPU computations.
2017-06-28 16:42:54.099744: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:901]
successful NUMA node read from SysFS had negative value (-1),
but there must be at least one NUMA node, so returning NUMA node zero
2017-06-28 16:42:54.100218: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887]
Found device 0 with properties:
name: Tesla M60
major: 5 minor: 2 memoryClockRate (GHz) 1.1775
pciBusID 0000:00:02.0
Total memory: 7.93GiB
Free memory: 7.86GiB
2017-06-28 16:42:54.100243: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0
2017-06-28 16:42:54.100251: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0: Y
2017-06-28 16:42:54.100266: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977]
Creating TensorFlow device (/gpu:0) -> (device: 0, name: Tesla M60, pci bus id: 0000:00:02.0)
>>> print(sess.run(hello))
Hello, TensorFlow!