Tensorflow 无分配器统计

Tensorflow no allocator Statistics

从昨天开始,我在使用 Tensorflow 和任何版本的 cuda 时都遇到了奇怪的问题 即使我只是打电话

我也会收到错误消息
import tensorflow as tf; tf.test.is_gpu_available()

我明白了

>>> import tensorflow as tf 2021-04-16 21:23:14.876381: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll INFO:tensorflow:Enabling eager execution INFO:tensorflow:Enabling v2 tensorshape INFO:tensorflow:Enabling resource variables INFO:tensorflow:Enabling tensor equality INFO:tensorflow:Enabling control flow v2 --> tf.test.is_gpu_available() 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: Usetf.config.list_physical_devices('GPU') instead. 2021-04-16 21:23:25.481405: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2021-04-16 21:23:25.484960: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll 2021-04-16 21:23:25.520614: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1733] Found device 0 with properties: pciBusID: 0000:09:00.0 name: NVIDIA GeForce RTX 2060 SUPER computeCapability: 7.5 coreClock: 1.65GHz coreCount: 34 deviceMemorySize: 8.00GiB deviceMemoryBandwidth: 417.29GiB/s 2021-04-16 21:23:25.520759: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudart64_110.dll 2021-04-16 21:23:25.529842: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublas64_11.dll 2021-04-16 21:23:25.529971: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cublasLt64_11.dll 2021-04-16 21:23:25.534167: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll 2021-04-16 21:23:25.535573: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll 2021-04-16 21:23:25.540947: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_11.dll 2021-04-16 21:23:25.544673: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusparse64_11.dll 2021-04-16 21:23:25.545533: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cudnn64_8.dll 2021-04-16 21:23:25.545662: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1871] Adding visible gpu devices: 0 2021-04-16 21:23:26.045993: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1258] Device interconnect StreamExecutor with strength 1 edge matrix: 2021-04-16 21:23:26.046109: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1264] 0 2021-04-16 21:23:26.047907: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1277] 0: N 2021-04-16 21:23:26.048739: I tensorflow/core/common_runtime/gpu/gpu_process_state.cc:210] Using CUDA malloc Async allocator for GPU. Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Users\Weise\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\util\deprecation.py", line 337, in new_func return func(*args, **kwargs) File "C:\Users\Weise\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\framework\test_util.py", line 1600, in is_gpu_available for local_device in device_lib.list_local_devices(): File "C:\Users\Weise\AppData\Roaming\Python\Python39\site-packages\tensorflow\python\client\device_lib.py", line 43, in list_local_devices _convert(s) for s in _pywrap_device_lib.list_devices(serialized_config) RuntimeError: No allocator statistics

当我调用 Convolutional() 我明白了 同样的错误

更多详情请看 https://github.com/tensorflow/tensorflow/issues/48571

tf.test.is_gpu_available() 已弃用,您可以尝试使用 tf.config.list_physical_devices('GPU').

RuntimeError: No allocator statistics

根据 github,删除所有 cuda 文件后 CUDA 11.2 的全新安装已解决问题。