无法插入'nvidia_352':没有这样的设备

bat*_*man 16 linux ubuntu cuda nvidia caffe

我试图运行朱古力Linux Ubuntu.安装后,我在gpu中运行caffe,错误是

I0910 13:28:13.606891 10629 caffe.cpp:296] Use GPU with device ID 0
modprobe: ERROR: could not insert 'nvidia_352': No such device
F0910 13:28:13.728612 10629 common.cpp:142] Check failed: error == cudaSuccess (38 vs. 0)  no CUDA-capable device is detected
*** Check failure stack trace: ***
    @     0x7ffd3b9a7daa  (unknown)
    @     0x7ffd3b9a7ce4  (unknown)
    @     0x7ffd3b9a76e6  (unknown)
    @     0x7ffd3b9aa687  (unknown)
    @     0x7ffd3bf91cb5  caffe::Caffe::SetDevice()
    @           0x40a5a7  time()
    @           0x4080f8  main
    @     0x7ffd3aeb9ec5  (unknown)
    @           0x408618  (unknown)
    @              (nil)  (unknown)
Aborted (core dumped)
Run Code Online (Sandbox Code Playgroud)

我的NVIDIA驱动程序是352.41.我安装了352并安装了最新版本.

sudo apt-get install nvidia-352[sudo] 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nvidia-352 is already the newest version.
The following packages were automatically installed and are no longer required:
  account-plugin-windows-live libupstart1
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 31 not upgraded.
Run Code Online (Sandbox Code Playgroud)

我的Ubuntu有NVIDIA驱动程序352,为什么我有错误

I0910 13:28:13.606891 10629 caffe.cpp:296] Use GPU with device ID 0
    modprobe: ERROR: could not insert 'nvidia_352': No such device
    F0910 13:28:13.728612 10629 common.cpp:142] Check failed: error == cudaSuccess (38 vs. 0)  no CUDA-capable device is detected
Run Code Online (Sandbox Code Playgroud)

我检查了我是否有像CUDA这样的设备

lspci | grep -i nvidia
05:00.0 VGA compatible controller: NVIDIA Corporation GK107GL [Quadro K2000] (rev a1)
05:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)
Run Code Online (Sandbox Code Playgroud)

我有CUDA功能的设备,为什么我得到错误?

编辑1:是的,我的测试使用./deviceQuery失败了.

../NVIDIA_CUDA-7.5_Samples/bin/x86_64/linux/release/deviceQuery Starting...

 CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 38
-> no CUDA-capable device is detected
Result = FAIL
Run Code Online (Sandbox Code Playgroud)

我检查了dev /文件夹,我有nvidia0.

crwxrwxrwx  1 root root    195,   0 Sep 10 16:51 nvidia0
crw-rw-rw-  1 root root    195, 255 Sep 10 16:51 nvidiactl
Run Code Online (Sandbox Code Playgroud)

我的nvcc -V检查给了我

li@li-HP-Z420-Workstation:/dev$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Tue_Aug_11_14:27:32_CDT_2015
Cuda compilation tools, release 7.5, V7.5.17
Run Code Online (Sandbox Code Playgroud)

然后我的版本检查

li@li-HP-Z420-Workstation:/dev$ cat /proc/driver/nvidia/version
NVRM version: NVIDIA UNIX x86_64 Kernel Module  352.41  Fri Aug 21 23:09:52 PDT 2015
GCC version:  gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04) 
Run Code Online (Sandbox Code Playgroud)

可能有什么不对?

bat*_*man 11

现在问题解决了.我检查sudo dpkg --list | grep nvidia 我发现我的内核有352.41,但客户端有304.12.所以我做到了sudo apt-get remove --purge nvidia-*.它删除了所有包.然后,安装352.41 as

$ sudo add-apt-repository ppa:xorg-edgers/ppa -y
$ sudo apt-get update
$ sudo apt-get install nvidia-352
Run Code Online (Sandbox Code Playgroud)

之后

$ sudo dpkg --list | grep nvidia
rc nvidia-304 304.128-0ubuntu0~gpu14.04.2 amd64 NVIDIA legacy binary driver - version 304.128
rc nvidia-304-updates 304.125-0ubuntu0.0.2 amd64 NVIDIA legacy binary driver - version 304.125
ii nvidia-352 352.41-0ubuntu0~gpu14.04.1 amd64 NVIDIA binary driver - version 352.41
rc nvidia-opencl-icd-304 304.128-0ubuntu0~gpu14.04.2 amd64 NVIDIA OpenCL ICD
rc nvidia-opencl-icd-304-updates 304.125-0ubuntu0.0.2 amd64 NVIDIA OpenCL ICD
ii nvidia-opencl-icd-352 352.41-0ubuntu0~gpu14.04.1 amd64 NVIDIA OpenCL ICD
ii nvidia-prime 0.6.2 amd64 Tools to enable NVIDIA's Prime
ii nvidia-settings 355.11-0ubuntu0~gpu14.04.1 amd64 Tool for configuring the NVIDIA graphics driver
Run Code Online (Sandbox Code Playgroud)

现在版本匹配.然后./deviceQuery和所有工作按预期进行.谢谢


bat*_*man 0

我可以做的另一种方法是使用 .run 文件安装。那需要先杀死X服务器。X 服务器被杀死如下。

Make sure you are logged out.
Hit CTRL+ALT+F1 and login using your credentials.
kill your current X server session by typing sudo service lightdm stop or sudo stop lightdm
Enter runlevel 3 (or 5) by typing sudo init 3 (or sudo init 5) and install your .run file.
You might be required to reboot when the installation finishes. If not, run sudo service start lightdm or sudo start lightdm to start your X server again.
Run Code Online (Sandbox Code Playgroud)

然后run .run file as sudo sh xxxxx.run

您可能会收到如下错误The distribution-provided pre-install script failed! Are you sure you want to continue?。然后中止安装并

disable the "Nouveau kernel driver" as sudo update-initramfs -u
Run Code Online (Sandbox Code Playgroud)

然后重新启动系统并redo stop X server, enter runlevel 3 and do sudo sh xxxx.run again.

这次您可以忽略该消息并继续执行该处方失败消息。然后您将能够从 .run 文件安装 Nvidia 驱动程序。