I have an old Intel Core i7 950 CPU with no AVX support, a newer NVIDIA RTX 3060 Ti GPU with compute capability 8.6, and the Windows 10 OS. Despite the default Tensorflow distribution requiring AVX support, after MANY trials and errors I was able to install Tensorflow from this wheel, which was compiled for CPUs with no AVX support.

In order to do so I had to downgrade to python 3.9, CUDA 11.7, cudnn 8.9.5 and NumPy 1.22.4.

Now, when I import tensorflow as tf in python I do not get an error message yay! However, when I try the function: tf.config.list_physical_devices('GPU'), I get :

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.

See the actual outpub below:

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')]

Now, the very first time I ran it, it did take about 30 min to get the result, now every time I run it, I get the same output but the result is immediate (i.e. don't have to wait 30 minutes to get [PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]. Note that when I run the same function in the same session I don't get the warning again.

  1. What causes the Warning to show up every time?
  2. How do I get rid of it?
1

There are 1 best solutions below

2
On

I am not sure why I was downgraded, but by googling with the term "suppress", I found the answer to my second question:

Method 1 (learned from here):

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'

Method 2 (learned from here):

pip install silence_tensorflow

Then add:

from silence_tensorflow import silence_tensorflow
silence_tensorflow()

I still don't know the answer to my first question...

Thanks