bug!!!|安装Tensorflow 报错false Not creating XLA devices, tf_xla_enable_xla_devices not set
学习图像识别配置环境 https://blog.csdn.net/weixin_44170512/article/details/103990592
一步一步按照博主配置 执行到这两句
import tensorflow as tf
tf.test.is_gpu_available()
没有出现理想中的True
而是
tf.test.is_gpu_available()
WARNING:tensorflow:From :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.
2021-04-05 14:02:21.915504: 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:AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-04-05 14:02:21.934755: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library nvcuda.dll
2021-04-05 14:02:21.964341: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1720] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1660 Ti computeCapability: 7.5
coreClock: 1.59GHz coreCount: 24 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 268.26GiB/s
2021-04-05 14:02:21.975404: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudart64_110.dll';
dlerror: cudart64_110.dll not found
2021-04-05 14:02:21.982301: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cublas64_11.dll';
dlerror: cublas64_11.dll not found
2021-04-05 14:02:21.990611: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cublasLt64_11.dll';
dlerror: cublasLt64_11.dll not found
2021-04-05 14:02:21.998148: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cufft64_10.dll
2021-04-05 14:02:22.005014: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library curand64_10.dll
2021-04-05 14:02:22.021819: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] Successfully opened dynamic library cusolver64_10.dll
2021-04-05 14:02:22.028394: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cusparse64_11.dll';
dlerror: cusparse64_11.dll not found
2021-04-05 14:02:22.038022: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] Could not load dynamic library 'cudnn64_8.dll';
dlerror: cudnn64_8.dll not found
2021-04-05 14:02:22.042773: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1757] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
2021-04-05 14:02:22.157380: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1261] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-05 14:02:22.161928: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1267]0
2021-04-05 14:02:22.164252: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1280] 0:N
2021-04-05 14:02:22.167049: I tensorflow/compiler/jit/xla_gpu_device.cc:99] Not creating XLA devices, tf_xla_enable_xla_devices not set
False
conda list检查自己的tensflow版本号
文章图片
版本为 2.4.1
参考官方tensorflow与cuda对应图
文章图片
并没有tensorflow_gpu-2.4.1这个版本 但我的cuda版本是10.1 cudnn版本是7.6.1 于是我就降级了TensorFlow的版本号 降成2.3.0
使用代码:
pip install tensorflow-gpu==2.3.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
【bug!!!|安装Tensorflow 报错false Not creating XLA devices, tf_xla_enable_xla_devices not set】再次执行
import tensorflow as tf
2021-04-05 14:14:43.793545: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
>>> tf.test.is_gpu_available()
WARNING:tensorflow:From :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.
2021-04-05 14:15:02.496781: 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:AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2021-04-05 14:15:02.518727: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27fbeb2c710 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2021-04-05 14:15:02.525553: I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor device (0): Host, Default Version
2021-04-05 14:15:02.530213: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll
2021-04-05 14:15:02.562486: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties:
pciBusID: 0000:01:00.0 name: GeForce GTX 1660 Ti computeCapability: 7.5
coreClock: 1.59GHz coreCount: 24 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 268.26GiB/s
2021-04-05 14:15:02.571997: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudart64_101.dll
2021-04-05 14:15:03.024554: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cublas64_10.dll
2021-04-05 14:15:03.031989: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll
2021-04-05 14:15:03.037297: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll
2021-04-05 14:15:03.046763: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll
2021-04-05 14:15:03.281223: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusparse64_10.dll
2021-04-05 14:15:03.560161: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cudnn64_7.dll
2021-04-05 14:15:03.564981: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1858] Adding visible gpu devices: 0
2021-04-05 14:15:04.163256: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix:
2021-04-05 14:15:04.169328: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263]0
2021-04-05 14:15:04.172439: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1276] 0:N
2021-04-05 14:15:04.175762: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1402] Created TensorFlow device (/device:GPU:0 with 4615 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1660 Ti, pci bus id: 0000:01:00.0, compute capability: 7.5)
2021-04-05 14:15:04.188031: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x27fe8d39530 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2021-04-05 14:15:04.195294: I tensorflow/compiler/xla/service/service.cc:176]StreamExecutor device (0): GeForce GTX 1660 Ti, Compute Capability 7.5
True
结果正确
推荐阅读
- 大数据|2021全球程序员收入报告出炉!字节高级码农年薪274万元排第5【文末送5本书】...
- XingleiGao的日常|Atlas 200 DK开发者套件基于CANN的垃圾分类实验踩坑指南
- 机器学习|机器学习——垃圾邮件识别——SVM、MNB模型使用
- 智能车|智能车图像处理(六)八邻域-1
- 机器学习教程目录
- 强化学习教程
- NLP教程 – 机器学习
- 什么是数据科学(数据科学入门)
- 机器学习随机森林算法