简体   繁体   English

如何解决 Tensorflow -GPU 的警告?

[英]How do I solve warnings for Tensorflow -GPU?

I am trying to install tensorflow-gpu in python, ubuntu 18.04, using pip command as pip install tensorflow-gpu==2.1.0 when I run this command: import tensorflow as tf I get following error: I am trying to install tensorflow-gpu in python, ubuntu 18.04, using pip command as pip install tensorflow-gpu==2.1.0 when I run this command: import tensorflow as tf I get following error:

>>> 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.

And when I run tf.test.is_gpu_available() I get True but I got lots of warnings as follow:当我运行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

I am not sure if these warnings/errors will interrupt GPU usage.我不确定这些警告/错误是否会中断 GPU 的使用。 How do I solve this?我该如何解决这个问题?

In your first log, it just says that you did not install the TensorRT .在您的第一个日志中,它只是说您没有安装TensorRT If you don't want use that Feature of tensorflow, just forget this warning.如果您不想使用 tensorflow 的该功能,请忽略此警告。

Then, for you gpu test, your log has no problem, and you can focus gpu matrix part然后,为你gpu测试,你的log没有问题,可以重点关注gpu矩阵部分

# tf.test.is_gpu_available() on my machine, which has three gpu
   0  1  2
0: N  N  N
1: N  N  N
2: N  N  N

and the final output和最后的 output

True

By the way, if you want to turn these boring logs off, you can set as below.顺便说一句,如果你想关闭这些无聊的日志,你可以设置如下。

''' TF_CPP_MIN_LOG_LEVEL
0 = all messages are logged (default behavior)
1 = INFO messages are not printed
2 = INFO and WARNING messages are not printed
3 = INFO, WARNING, and ERROR messages are not printed
'''
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM