【发布时间】:2020-08-04 22:30:47
【问题描述】:
我正在尝试在 python、ubuntu 18.04 中安装 tensorflow-gpu,使用 pip 命令作为 pip install tensorflow-gpu==2.1.0 运行此命令时:import tensorflow as tf 我收到以下错误:
>>> import tensorflow as tf
2020-08-04 16:06:41.659287: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-10.1/lib64
2020-08-04 16:06:41.659398: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-10.1/lib64
2020-08-04 16:06:41.659413: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
当我运行 tf.test.is_gpu_available() 时,我得到了 True,但我收到了很多如下警告:
WARNING:tensorflow:From <stdin>:1: is_gpu_available (from tensorflow.python.framework.test_util) is deprecated and will be removed in a future version.
Instructions for updating:
Use `tf.config.list_physical_devices('GPU')` instead.
2020-08-04 16:08:33.381085: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA
2020-08-04 16:08:33.423734: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2199995000 Hz
2020-08-04 16:08:33.425574: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x41e6da0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-08-04 16:08:33.425653: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version
2020-08-04 16:08:33.432949: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-08-04 16:08:33.580069: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.580423: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x4282490 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-08-04 16:08:33.580441: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): GeForce GTX 1060, Compute Capability 6.1
2020-08-04 16:08:33.580561: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.580785: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1555] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1060 computeCapability: 6.1
coreClock: 1.733GHz coreCount: 10 deviceMemorySize: 5.94GiB deviceMemoryBandwidth: 178.99GiB/s
2020-08-04 16:08:33.583471: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-08-04 16:08:33.641250: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10
2020-08-04 16:08:33.675210: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10
2020-08-04 16:08:33.683125: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10
2020-08-04 16:08:33.744338: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10
2020-08-04 16:08:33.753194: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10
2020-08-04 16:08:33.763988: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-08-04 16:08:33.764318: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.765495: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.766332: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1697] Adding visible gpu devices: 0
2020-08-04 16:08:33.766456: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.1
2020-08-04 16:08:33.769895: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1096] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-08-04 16:08:33.769951: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1102] 0
2020-08-04 16:08:33.769973: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] 0: N
2020-08-04 16:08:33.770273: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.771146: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:981] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero
2020-08-04 16:08:33.771798: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1241] Created TensorFlow device (/device:GPU:0 with 4847 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060, pci bus id: 0000:01:00.0, compute capability: 6.1)
True
我不确定这些警告/错误是否会中断 GPU 的使用。我该如何解决?
【问题讨论】:
-
你是否安装了GPU安装的tensorflow软件要求?,如果没有按照这个:tensorflow.org/install/gpu
-
要求是指CUDA吗?如果是的话,我安装了 CUDA 10.1
-
你用的是什么版本的tensorflow?
-
首先,没有错误。您称之为“错误”的第一组事情实际上是警告 - 它们前面是
W。下一个块以警告开头,然后其余的都是信息性的 - 它们以I开头。那么让我们来看看这三件事。 1.前3个警告与TensorRT有关(libnvinfer是TRT的一部分)。如果您不打算使用 TRT,可以忽略这些警告。无论如何,它只会在模型评估期间使用,而不是在训练期间使用。 2. 下一个警告只是对你大喊大叫,让你使用其他东西来测试 GPU 是否存在。 -
3.最后一组信息输出
I在我看来都很好。它告诉您:它成功打开了一堆库,numa 节点查询存在一些问题,因此假设您只有 1 个 numa 节点,这可能是正确的,并且它正确响应您的 GPU 查询 - 告诉您是的,你有一个 GPU (True),它是一个 GTX1060。说了这么多,如果你想“解决”TRT 的问题,那就安装 TensorRT。我想你应该可以找到instructions to do that。
标签: tensorflow gpu ubuntu-18.04 nvidia