LoginSignup
0
0

Ubuntu22.04 + Docker + TF2.13.1 をGPUありで動かす

Posted at

Could not find cuda drivers on your machine, GPU will not be used.

どうしてもこの呪いメッセージが消えない。

やったこと

多すぎて思い出せないくらい。

  • ホストのnvidia driver入れ替え
  • cuda いろいろバージョン
  • TF いろいろバージョン
  • pip install "tensorflow-gpu<2.11
  • OS再インストール
  • 環境変数設定
  • ライブラリローカルビルド
  • Dockerイメージ入れ替え(10個くらい試したが当たりを引けず)。しかし当たりはあった(後述)

しかし解呪はできなかった。。。

あっさり解決

ベースのDockerイメージで動くものがありました。

2023/10 現在であれば
FROM nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04
をベースに
pip install tensorflow

>tf.config.list_physical_devices("GPU")
[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]

解呪できました。

いばらの道が好きな方

たぶん
FROM nvidia/cuda:11.8.0-base-ubuntu22.04
ベースにcudnnとか入れていっても動くかもです(というか1回動いてたのに手順をメモってなかったので再現できず)。

TF 2.14.xは?

https://www.tensorflow.org/install/source?hl=ja#gpu
によれば 11.8 で動くはずなんですが、先ほどのイメージでpipでTFを入れると2.13.1が入っちゃいます。手で入れられるかもですがためしていません(疲れた)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0