TensorFlow で GPU が有効にならない時

python How To

CUDA も cuDNN もインストールして パスもちゃんと通っているのに使えなくて、悩みに悩んで見つけた答えです。

エラー内容

2020-07-25 21:03:14.427523: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-07-25 21:03:14.433183: 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.
2020-07-25 21:03:19.263633: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-25 21:03:19.450067: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce GTX 760 computeCapability: 3.0 coreClock: 1.0585GHz coreCount: 6 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 179.05GiB/s
2020-07-25 21:03:19.460269: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-07-25 21:03:19.466664: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found
2020-07-25 21:03:19.477715: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cufft64_10.dll'; dlerror: cufft64_10.dll not found
2020-07-25 21:03:19.483943: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'curand64_10.dll'; dlerror: curand64_10.dll not found
2020-07-25 21:03:19.490209: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusolver64_10.dll'; dlerror: cusolver64_10.dll not found
2020-07-25 21:03:19.496002: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found
2020-07-25 21:03:19.502397: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found
2020-07-25 21:03:19.509451: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1598] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices…

環境

  • Windows 10 Home 2004
  • Python 3.7.8
  • pip 20.1.1
  • TensorFlow 2.2.0
  • CUDA 10.1
  • cuDNN v7.6.5

原因

Python のインストール方法が悪かった。

NG: Microsoft Store

OK: 公式サイト

対処方法

Python を Microsoft Store からインストールしないで、公式サイト インストーラーを使って インストール する。

たったこれだけの事でした。

コマンドプロンプトで簡単にインストール出来るから重宝していたんですが、とんだ落とし穴でした。

その後

ちゃんと GPU が認識されています。

2020-07-25 21:43:17.525257: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-25 21:43:21.457325: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library nvcuda.dll
2020-07-25 21:43:21.516624: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1561] Found device 0 with properties: pciBusID: 0000:01:00.0 name: GeForce GTX 760 computeCapability: 3.0 coreClock: 1.0585GHz coreCount: 6 deviceMemorySize: 2.00GiB deviceMemoryBandwidth: 179.05GiB/s
2020-07-25 21:43:21.534583: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_101.dll
2020-07-25 21:43:21.603125: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cublas64_10.dll
2020-07-25 21:43:21.657679: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cufft64_10.dll
2020-07-25 21:43:21.686695: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library curand64_10.dll
2020-07-25 21:43:21.749413: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusolver64_10.dll
2020-07-25 21:43:21.785608: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cusparse64_10.dll
2020-07-25 21:43:21.879769: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudnn64_7.dll
2020-07-25 21:43:21.886224: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1657] Ignoring visible gpu device (device: 0, name: GeForce GTX 760, pci bus id: 0000:01:00.0, compute capability: 3.0) with Cuda compute capability 3.0. The minimum required Cuda capability is 3.5.
タイトルとURLをコピーしました