我正在嘗試在虛擬機上的 docker 中運行具有 gpu 支持的 tensorflow。我嘗試了很多在線解決方案,包括:
- 嘗試了 tensorflow 版本的不同 docker 鏡像:2.6、2.4、1.15、1.14
- 根據本指南多次使用不同的 bazel 標志從容器內部的源構建 tensorflow


Python 版本是: Python 3.8.10
和張量流版本是:
import tensorflow as tf tf.__version__ '2.6.0'錯誤出現在:tf.config.list_physical_devices()

所以 GPU 不知何故對張量流不可見。所有 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。
這里發生了什么?我該如何解決?
uj5u.com熱心網友回復:
我意識到 GPU 具有多實體功能:

因此,應配置 GPU 實體:
sudo nvidia-smi mig -cgi 0 -C
之后呼叫 nvidia-smi 時,您會得到:

問題解決了!
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/350067.html
