あきらぼ

テック系ブログ

Python Tensorflow でcudart64_110.dll not found

PythonのTensorflowでプリグラムを実行しようとしたところ以下のようなエラーが出ました。

2022-04-24 20:52:29.885267: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2022-04-24 20:52:29.885774: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

単純にCUDAとcuDNNがインストールされていないためのエラーになります。

まずCUDAを以下からインストールします。
developer.nvidia.com

次に、cuDNNを以下のサイトからダウンロードします。
developer.nvidia.com

インストールのやり方は、単純にCUDAのインストール先に解凍したcuDNNの中のbin, includeファイル等をすべてコピーするだけです。
私の場合は以下のパスです。
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6

最後にパス通して完了です。

するとエラーが以下のように無くなりました。

2022-04-24 22:22:43.985293: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations:  AVX
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2022-04-24 22:22:44.743542: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1525] Created device /job:localhost/replica:0/task:0/device:GPU:0 with 9633 MB memory:  -> device: 0, name: NVIDIA GeForce GTX 1080 Ti, pci bus id: 0000:01:00.0, compute capability: 6.1

しかし、cuDNNとTensorflow, CUDA等には動かないバージョンの組み合わせがあるので気を付けてください。
私も他のところでバージョンによるエラーが生じました。

以下の記事参照。
aki-lab.hatenadiary.com