Tensorflow 警告:TensorFlow 不是使用与计算能力 8.6 兼容的 CUDA 内核二进制文件构建的

问题描述 投票:0回答:1

我有一个旧的 Intel Core i7 950 CPU,没有 AVX 支持,一个较新的 NVIDIA RTX 3060 Ti GPU,具有计算能力 8.6,以及 Windows 10 操作系统。尽管默认的 Tensorflow 发行版需要 AVX 支持,但经过多次尝试和错误后,我能够从thiswheel安装 Tensorflow,该轮子是为不支持 AVX 的 CPU 编译的。 为此,我必须降级到 python 3.9、CUDA 11.7、cudnn 8.9.5 和 NumPy 1.22.4。 现在,当我在 python 中

import tensorflow as tf
时,我没有收到错误消息耶! 然而,当我尝试这个功能:
tf.config.list_physical_devices('GPU')
时,我得到:

W tensorflow/core/common_runtime/gpu/gpu_device.cc:1943] TensorFlow was not built with CUDA kernel binaries compatible with compute capability 8.6. CUDA kernels will be jit-compiled from PTX, which could take 30 minutes or longer.

请参阅下面的实际输出:

C:\Users\Luca>python
Python 3.9.13 (tags/v3.9.13:6de2ca5, May 17 2022, 16:36:42) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
>>> tf.config.list_physical_devices('GPU')
2023-09-23 11:37:43.077533: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1943] TensorFlow was not built with CUDA kernel binaries compatible with compute capability 8.6. CUDA kernels will be jit-compiled from PTX, which could take 30 minutes or longer.
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
>>> tf.config.list_physical_devices('GPU')
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

现在,第一次我运行它时,确实花了大约30分钟才能得到结果,现在每次我运行它,我都会得到相同的输出,但结果是立即(即不必须等待 30 分钟才能得到

[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
。请注意,当我在同一会话中运行相同的函数时,我不会再次收到警告。

    什么原因导致每次都出现警告?
  1. 如何摆脱它?
谢谢

卢卡

python tensorflow gpu avx compute-capability
1个回答
0
投票
我不确定为什么我被降级,但是通过谷歌搜索“抑制”一词,我找到了我的

第二个问题的答案:

方法一(从

这里学来的):

import os # Value for 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'] = '2'
方法2(从

这里学来的):

pip install silence_tensorflow
然后添加:

from silence_tensorflow import silence_tensorflow silence_tensorflow()
我仍然不知道第一个问题的答案...

谢谢

© www.soinside.com 2019 - 2024. All rights reserved.