我最近安装了Nvidia 驱动程序-375.39、Cuda-8.0 和 CUDNN-5.1经历了许多头痛和困难。在此之后我安装了Tensorflow,因为这就是我从一开始就想做的事情。
我从以下来源获得了帮助:
http://queirozf.com/entries/installing-cuda-tk-and-tensorflow-on-a-clean-ubuntu-16-04-install
https://pythonprogramming.net/how-to-cuda-gpu-tensorflow-deep-learning-tutorial/
我已经安装了 tensorflow虚拟环境在运行 Nvidia Geforce 940MX 的 ubuntu 16.04 上。
虽然我无法运行 Cuda 示例(随cuda_8.0.61_375.26_linux.运行文件本身),给出了一些错误,例如:
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
/usr/bin/ld: cannot find -lglut
collect2: error: ld returned 1 exit status
Makefile:267: recipe for target 'simpleGL' failed
make[1]: *** [simpleGL] Error 1
make[1]: Leaving directory '/home/jayant/NVIDIA_CUDA-8.0_Samples/2_Graphics/simpleGL'
Makefile:52: recipe for target '2_Graphics/simpleGL/Makefile.ph_build' failed
make: *** [2_Graphics/simpleGL/Makefile.ph_build] Error 2
我仍然安装了 tensorflow,现在我怀疑它是否使用 Cuda。
当我尝试导入 tensorflow 时,我产生了疑问,如下所示:
>>>import tensorflow as tf
>>>hello = tf.constant('Hello, TensorFlow!')
>>>sess = tf.Session()
>>>print(sess.run(hello))
我没有收到这些消息(正如许多博客中提到的):
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:108] successfully opened CUDA library libcurand.so locally
相反,我得到了这个:
2017-05-01 00:08:12.079557: 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-05-01 00:08:12.079584: 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-05-01 00:08:12.079588: 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-05-01 00:08:12.079591: 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-05-01 00:08:12.079595: 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-05-01 00:08:12.322193: 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-05-01 00:08:12.322566: I tensorflow/core/common_runtime/gpu/gpu_device.cc:887] Found device 0 with properties:
name: GeForce 940MX
major: 5 minor: 0 memoryClockRate (GHz) 1.189
pciBusID 0000:01:00.0
Total memory: 3.95GiB
Free memory: 3.93GiB
2017-05-01 00:08:12.322580: I tensorflow/core/common_runtime/gpu/gpu_device.cc:908] DMA: 0
2017-05-01 00:08:12.322584: I tensorflow/core/common_runtime/gpu/gpu_device.cc:918] 0: Y
2017-05-01 00:08:12.322593: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0)
Hello, TensorFlow!
有人可以告诉我我的库达已正确安装,并且TensorFlow正确运行库达?
或者我需要做哪些更改才能抑制这些警告,运行库达成功采样并获取有关库达开放图书馆?
PS:如果需要任何其他信息,请告诉我。
答案1
首先确保您使用的是 Nvidia 硬件和驱动程序。检查您的 UEFI 设置(以前称为 BIOS)中是否有任何视频硬件选择。最好选择“独立”而不是任何混合或优化,直到一切正常。然后从“软件更新程序”/“设置”按钮/“其他驱动程序”选项卡中使用 Ubuntu 提供的 Nvidia 驱动程序。选择“经过测试的”Nvidia 驱动程序(可能是最新的)。请注意,367 之后和 381 之前的驱动程序存在一些问题,导致睡眠后出现一些屏幕伪影。当您选择的 Nvidia 驱动程序是正在使用的驱动程序时,注销/登录或重新启动并检查 Nvidia 驱动程序是否显示在 lshw -C 视频输出中,或者只需从 Dash 运行 Nvidia 设置进行检查。然后继续 CUDA 安装。
一些 CUDA 示例需要额外的库。您选择的示例需要 libglut,因此请安装 freeglut3 包。在尝试任何更复杂的操作之前,一定要先让示例运行起来。许多示例允许使用“-cpu”参数来显示使用 CPU 而不是 GPU 时的速度减慢了多少。也许 tensorflow 有类似的东西。
您是否检查过其他博客中提到的库是否存在于您的系统中?如果没有,则可能需要单独安装它们,但同样,TensorFlow 可能不需要它们来实现其可以执行的每个功能。