Centos7 安裝獨立顯卡驅動


Centos7 安裝獨立顯卡驅動

參考:

https://blog.csdn.net/u013378306/article/details/69229919

安裝基礎依賴環境

Yum install gcc kernel-delve -y

 

注意事項,保證內核版本和源碼版本一樣,否則,安裝報錯誤6:

  •  查看內核版本:
    ls /boot | grep vmlinu

     

  • 查看源碼包版本
    rpm -aq | grep kernel-devel

     

從上面的輸出中可以看出內核版本號和內核源碼版本。為了解決這個錯誤,需要從FC官方網站上下載與內核版本對應的源碼包進行安裝。
可以在以下網站下載並安裝:
http://rpmfind.net/linux/rpm2html/search.php?query=kernel-devel

 

源碼安裝

1 在英偉達官網下載相應驅動

搜索出相應的驅動后,不要直接點,而是右健,Save Link as...

否則,會出現下載半天沒動靜的情況。

存放的路徑上最好不要有中文。

我存放的路徑是 ~/Downloads/NVIDIA-Linux-x86_64-346.47.run

 

2 屏蔽默認帶有的nouveau

使用su命令切換到root用戶下: su root

打開/lib/modprobe.d/dist-blacklist.conf

 

將nvidiafb注釋掉。

#blacklist nvidiafb 

 

然后添加以下語句:

blacklist nouveau

options nouveau modeset=0

3 重建initramfs image步驟

mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak

dracut /boot/initramfs-$(uname -r).img $(uname -r) 

4 修改運行級別為文本模式

systemctl set-default multi-user.target 

5 重新啟動, 使用root用戶登陸

reboot

 

6 查看nouveau是否已經禁用

ls mod | grep nouveau

如果沒有顯示相關的內容,說明已禁用。

 

7 進入下載的驅動所在目錄

chmod +x NVIDIA-Linux-x86_64-346.47.run

./NVIDIA-Linux-x86_64-346.47.run

安裝過程中,選擇accept

如果提示要修改xorg.conf,選擇yes

8 修改運行級別回圖形模式

systemctl set-default graphical.target 

9 重新啟動,OK

在Applications--Other可以看見NVIDIA X Server Settings菜單。 

問題:

錯誤1:

ERROR: The Nouveau kernel driver is currently in use by your system.  This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding.  Please consult the NVIDIA driver README and your Linux distribution's documentation for details on how         to correctly disable the Nouveau kernel driver.

解釋:如果沒有執行屏蔽nouveau操作,報以上錯誤。

 

錯誤2:

unable to find the development too 'cc' in you path; please make sure that you have the package 'gcc

解決辦法:

yum install gcc

錯誤3:

錯誤4:

 ERROR: Unable to find the kernel source tree for the currently running kernel.  Please make sure you have installed the kernel source files for your

 kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the  'kernel-source' or 'kernel-devel' RPM installed.  If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.

解決辦法:

yum install kernel-delve

錯誤5:

 ERROR: Unable to find the kernel source tree for the currently running kernel.  Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the         'kernel-source' or 'kernel-devel' RPM installed.  If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.

 解決方法:

./NVIDIA-Linux-x86_64-390.67.run --kernel-source-path=/usr/src/kernels/3.10.0-862.3.2.el7.x86_64/ 

錯誤6:

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if another driver, such as nouveau, is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA GPU(s), or no NVIDIA GPU installed in this system is supported by this NVIDIA Linux graphics driver release.

         Please see the log entries 'Kernel module load error' and 'Kernel messages' at the end of the file '/var/log/nvidia-installer.log' for more information.

解決辦法:

  • 可以通過以下方式查看內核版本和源碼包版本:
    ls /boot | grep vmlinuz
  • 如果上面的命令輸出中有多個內核,則按grub.conf中指定的文件為准。
    rpm -aq | grep kernel-devel
    kernel-devel-2.6.35.13-92.fc14.i686
  • 從上面的輸出中可以看出內核版本號和內核源碼版本。為了解決這個錯誤,需要從FC官方網站上下載與內核版本對應的源碼包進行安裝。

         可以在以下網站下載並安裝:
        http://rpmfind.net/linux/rpm2html/search.php?query=kernel-devel

備注:執行更新內核操作好需要重新執行屏蔽nouveau,及重建initramfs image步驟。

 

警告:

 

WARNING: nvidia-installer was forced to guess the X library path '/usr/lib64' and X module path '/usr/lib64/xorg/modules'; these paths were not queryable from the system.  If X fails to find the NVIDIA X driver module, please install the `pkg-config` utility and the

           X.Org SDK/development package for your distribution and reinstall the driver.

字符模式安裝警告信息,可忽略。

安裝cuda

參考:https://blog.csdn.net/claroja/article/details/81034147

  1. 錯誤:

    Installing the CUDA Toolkit in /usr/local/cuda-6.5 ...
    Missing recommended library: libGLU.so
    Missing recommended library: libXmu.so

    解決:安裝第三方軟件

    yum install freeglut-devel libX11-devel libXi-devel libXmu-devel  \
    
    make mesa-libGLU-devel

     

  2. 測試CUDA

    [root@fengyun6 ~]# find / -name deviceQuery
    
    /root/NVIDIA_CUDA-9.0_Samples/1_Utilities/deviceQuery
    
    /usr/local/cuda-9.0/extras/demo_suite/deviceQuery
    
    /usr/local/cuda-9.0/samples/1_Utilities/deviceQuery

    若出現以下信息,則表示安裝成功

    [root@fengyun6 ~]# /usr/local/cuda-9.0/extras/demo_suite/deviceQuery
    
    /usr/local/cuda-9.0/extras/demo_suite/deviceQuery Starting...
    
     
    
     CUDA Device Query (Runtime API) version (CUDART static linking)
    
     
    
    Detected 1 CUDA Capable device(s)
    
     
    
    Device 0: "GeForce GTX 1080 Ti"
    
      CUDA Driver Version / Runtime Version          9.1 / 9.0
    
      CUDA Capability Major/Minor version number:    6.1
    
      Total amount of global memory:                 11178 MBytes (11721113600 bytes)
    
      (28) Multiprocessors, (128) CUDA Cores/MP:     3584 CUDA Cores
    
      GPU Max Clock rate:                            1645 MHz (1.64 GHz)
    
      Memory Clock rate:                             5505 Mhz
    
      Memory Bus Width:                              352-bit
    
      L2 Cache Size:                                 2883584 bytes
    
      Maximum Texture Dimension Size (x,y,z)         1D=(131072), 2D=(131072, 65536), 3D=(16384, 16384, 16384)
    
      Maximum Layered 1D Texture Size, (num) layers  1D=(32768), 2048 layers
    
      Maximum Layered 2D Texture Size, (num) layers  2D=(32768, 32768), 2048 layers
    
      Total amount of constant memory:               65536 bytes
    
      Total amount of shared memory per block:       49152 bytes
    
      Total number of registers available per block: 65536
    
      Warp size:                                     32
    
      Maximum number of threads per multiprocessor:  2048
    
      Maximum number of threads per block:           1024
    
      Max dimension size of a thread block (x,y,z): (1024, 1024, 64)
    
      Max dimension size of a grid size    (x,y,z): (2147483647, 65535, 65535)
    
      Maximum memory pitch:                          2147483647 bytes
    
      Texture alignment:                             512 bytes
    
      Concurrent copy and kernel execution:          Yes with 2 copy engine(s)
    
      Run time limit on kernels:                     No
    
      Integrated GPU sharing Host Memory:            No
    
      Support host page-locked memory mapping:       Yes
    
      Alignment requirement for Surfaces:            Yes
    
      Device has ECC support:                        Disabled
    
      Device supports Unified Addressing (UVA):      Yes
    
      Device PCI Domain ID / Bus ID / location ID:   0 / 1 / 0
    
      Compute Mode:
    
         < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) >
    
     
    
    deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 9.0, NumDevs = 1, Device0 = GeForce GT
    
    X 1080 TiResult = PASS

安裝cudnn

參考:https://www.cnblogs.com/mar-q/p/7482720.html

下載:https://developer.nvidia.com/rdp/cudnn-archive

安裝cudnn

tar -xvf cudnn-8.0-linux-x64-v6.0.tgz -C /usr/local/

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM