在成功安装和测试使用GPU支持编译的Tensorflow之后,我最近遇到了一个问题.

重新启动计算机后,当我尝试运行Tensorflow程序时收到以下错误消息:

...

('Extracting', 'MNIST_data/t10k-labels-idx1-ubyte.gz')

modprobe: FATAL: Module nvidia-uvm not found in directory /lib/modules/4.4.0-34-generic

E tensorflow/stream_executor/cuda/cuda_driver.cc:491] failed call to cuInit: CUDA_ERROR_UNKNOWN

I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:140] kernel driver does not appear to be running on this host (caffe-desktop): /proc/driver/nvidia/version does not exist

I tensorflow/core/common_runtime/gpu/gpu_init.cc:92] No GPU devices available on machine.

(0, 114710.45)

(1, 95368.891)

...

(98, 56776.922)

(99, 57289.672)

问:为什么重新启动Ubuntu 16.04机器会破坏Tensorflow?

解决方法:

我实际上解决了我自己的问题,并希望分享对我有用的解决方案.

谷歌的神奇搜索是:

“modprobe:致命:在目录/ lib / modules /中找不到模块nvidia-uvm”

该答案的作者Sneetsher在解释方面做得非常好,如果链接不是404,我会从那里开始.

悬崖笔记

诊断:我怀疑Ubuntu可能在重新启动时安装了内核更新.

解决方案:重新安装NVIDIA驱动程序修复了错误.

问题:无法在运行X服务器的情况下安装NVIDIA驱动程序

修复NVIDIA驱动程序的两种不同方法

1)键盘和显示器:

解释askubuntu答案:

1) Switch to text-only console (Ctrl+Alt+F1 or any to F6).

2) Build driver modules for the current kernel (which just installed) sudo ./.run -K

我没有连接到这台PC的键盘或显示器,所以这是我实际使用的“无头”方法:

2)通过SSH:

按照本指南重新启动到控制台:

$sudo cp -n /etc/default/grub /etc/default/grub.orig

$sudo nano /etc/default/grub

$sudo update-grub

根据上面的链接编辑grub文件(3个更改):

Comment the line GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash”, by adding # at the beginning, which will disable the Ubuntu purple screen.

Change GRUB_CMDLINE_LINUX=”” to GRUB_CMDLINE_LINUX=”text”, this makes Ubuntu boot directly into Text Mode.

Uncomment this line #GRUB_TERMINAL=console, by removing the # at the beginning, this makes Grub Menu into real black & white Text Mode (without background image)

UPDATE: (If running Ubuntu 16.04 If

$sudo systemctl set-default multi-user.target

Reboot into console

$sudo shutdown -r now

$sudo service lightdm stop

$sudo ./.run

按照NVIDIA驱动程序安装程序

$sudo mv /etc/default/grub /etc/default/grub.textonly

$sudo mv /etc/default/grub.orig /etc/default/grub

$sudo update-grub

$sudo shutdown -r now

结果(现在看起来像GPU成功检测到了什么)

...

('Extracting', 'MNIST_data/t10k-labels-idx1-ubyte.gz')

I tensorflow/core/common_runtime/gpu/gpu_init.cc:118] Found device 0 with properties:

name: GeForce GTX 970

major: 5 minor: 2 memoryClockRate (GHz) 1.342

pciBusID 0000:01:00.0

Total memory: 3.94GiB

Free memory: 3.88GiB

I tensorflow/core/common_runtime/gpu/gpu_init.cc:138] DMA: 0

I tensorflow/core/common_runtime/gpu/gpu_init.cc:148] 0: Y

I tensorflow/core/common_runtime/gpu/gpu_device.cc:868] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce GTX 970, pci bus id: 0000:01:00.0)

(0, 113040.92)

(1, 94895.867)

...

标签:python,gpu,tensorflow,nvidia

来源: https://codeday.me/bug/20190623/1267909.html

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐