基本的には WSL2 上で CUDA を使いたい - らんだむな記憶 を済ませて PyTorch をインストールするだけである。ところで、cuDNN を導入していなくて以下のような値が返ってくる:
>>> import torch >>> torch.backends.cudnn.version() 8500 >>> torch.backends.cudnn.enabled True
How to check if torch uses cuDNN - PyTorch Forums によるとどうやら
Yes, you just need to install the NVIDIA drivers and the binaries will come with the other libs. If you want to build from source, you would need to install CUDA, cuDNN etc.
ということで、pip
で導入する限りは最初から全部入りらしい。自分でビルドするなら cuDNN が必要ということらしい。自分でビルドするなら CUDA と cuDNN をインストールしなさいと。なんてことだ・・・。今までの苦労は・・・。
CUDA のほうも
$ nvcc -V Cuda compilation tools, release 11.8, V11.8.89 $ python >>> import torch >>> torch.version.cuda '11.7'
という感じでセットアップしたバージョンとは違った。なるほど・・・。