PyTorch) PyTorch GPU Installation
PyTorch is a powerful deep learning module. There are two version of PyTorch, PyTorch CPU and PyTorch GPU. If you want to run own program more fast, you need to use PyTorch GPU. In this post, I introduce how to install the module in Anaconda env.
1. Check the versions of dependencies
To use PyTorch GPU, you must already install NVIDIA CUDA.
-
Check CUDA Compute Capability of your GPU. You can check CUDA Compute Capability of your GPU from NVDIA developer. Almost GPU whose CUDA Compute Capability is more than 3.5 can run CUDA.
-
Find CUDA Toolkit version campatible with you GPU from CUDA wikipedia.
-
Check CUDA Toolkit version supported PyTorch from PyTorch website.
My GPU is GeForce GTX 1660 Ti whose CUDA Compute Capability is 7.5. And the stable version PyTorch supports CUDA 11.6. So I installed CUDA Toolkit 11.6.
2. Install CUDA, cuDNN and PyTorch
-
Install CUDA Toolkit from NVIDIA CUDA Toolkit Archive.
-
Install NVDIA CUDA Deep Neural Network Library(cuDNN). Before installation, you have to check the version of cuDNN that is compatible with CUDA Toolkit version which you choose. You can do both from cuDNN Archive. (You have to sign-in NVDIA DEVELOPER)
-
Check whether there are
CUDA_PATH
andCUDA_PATH_V11_6
(version is yours) in environment variable. If they are not, add the CUDA PATH.You have to change the version to yours.
-
Install PyTorch using the command that you can get from PyTorch website.
-
Check the PyTorch version and CUDA availability.
3. cuda.available: False
If torch.cuda.is_available()
returns False
although you installed PyTorch GPU, The version of dependencies is not correct or compatible. Check whether your GPU supports CUDA from NVDIA Forum. Change versions of your CUDA, cuDNN and PyTorch.
Refers
NVDIA DEVELOPER
CUDA wikipedia
PyTorch
Daehee YUN Tech Blog, “Python Pytorch 강좌 : 제 1강 - PyTorch 소개 및 설치”
BeomBeomJoJo, “[인공지능] Windows(윈도우) CUDA, cuDNN 설치방법”
코딩연습장, “NVDIA CUDA 및 cuDNN 설치 (Windows)”