python - tf.test.is_built_with_cuda() 应该输出什么?

标签 python tensorflow gpu conda

我通过 conda install tensorflow-gpu 安装了 tensorflow-gpu

但是,我安装的电脑没有GPU。我这样做是因为我正在将 conda env 移植到离线计算机。

当我将 tensorflow 导入为 tf 并调用 tf.test.is_built_with_cuda() 时,结果为 False。尽管计算机没有 GPU,但我希望结果为 True,因为我安装了 带领 tensorflow -GPU。 在这种情况下,tf.test.is_built_with_cuda() 的输出应该是什么?

为什么我得到 False

最佳答案

我刚刚使用之前运行 CUDA GPU 的服务器对此进行了测试,但后来移除了 GPU - 与您的情况非常相似。我安装了 tensorflow-gpu==2.5.0

>>> import tensorflow as tf
2021-07-28 18:42:44.236258: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
>>> tf.test.is_built_with_cuda()
True

记录了一个类似的问题 here .因此,您很可能缺少 CUDA/CUDNN。

关于python - tf.test.is_built_with_cuda() 应该输出什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68568748/

相关文章:

python - 使用来自第二个应用程序的模型测试 Django 应用程序

python - 如何将变化的数据延迟加载到 QColumnView 中(使用 PyQt)?

opencl - 内存复制速度对比 CPU<->GPU

python - 使用 python 子进程运行 shell 命令

python - Pyramid 通过 URL 获取路由名称(字符串)

tensorflow - 如何使用SSE4.2和AVX指令编译Tensorflow?

python - 使用数据集 API 在 Tensorflow 中滑动批处理窗口

machine-learning - TFLearn 模型评估

c++ - 在 C++ 中将矩阵高效分解为方形子矩阵

c# - Windows Mobile 上的 GPU 访问