【发布时间】:2021-11-02 14:41:15
【问题描述】:
我正在尝试在虚拟机上的 docker 中运行支持 gpu 的 tensorflow。我尝试了很多在线解决方案,包括:
- 尝试了 tensorflow 版本的不同 docker 镜像:2.6、2.4、1.15、1.14
- 根据本指南多次从容器内的源代码构建 tensorflow,并在 2.6 和 1.14 中使用不同的 bazel 标志 https://www.tensorflow.org/install/source
- 试图通过这些类型的命令使 GPU 可见:TensorFlow : failed call to cuInit: CUDA_ERROR_NO_DEVICE
- 使用了 nvidia tensorflow docker
没有一个解决方案适合我,这里有一些步骤:
我使用 nvidia-smi 和 nvcc -V 验证了驱动程序和 cuda 和 cudnn 工具包已安装在容器内:
Python 版本是: Python 3.8.10
和tensorflow版本是:
import tensorflow as tf
tf.__version__
'2.6.0'
错误出现: tf.config.list_physical_devices()
因此 GPU 在某种程度上对 tensorflow 不可见。所有 tensorflow 构建都返回相同的错误:
E tensorflow/stream_executor/cuda/cuda_driver.cc:271] failed call to cuInit: CUDA_ERROR_NOT_INITIALIZED: initialization error
但例如对于 1.14,有一条关于 CPU 类型的附加注释:
Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
GPU 是 A100,CPU 是 Intel(R) Xeon(R) Gold 6226R。
这里发生了什么?我该如何解决这个问题?
【问题讨论】:
标签: python docker tensorflow nvidia-docker