Step by step instruction to install Cuda, Cudnn , Tensorflow and Pytorch for GPU environment
December 31, 2022 Ask Question and Get Answer, computer vision, Machine learning & Deep Learning 0 Comments
To install CUDA, CUDNN, TensorFlow, and PyTorch for GPU, you will need to follow the steps below:
Install NVIDIA drivers:
- Check if you have an NVIDIA GPU in your system by running the command
lspci | grep -i nvidiain the terminal.
- If you do not have an NVIDIA GPU, you will not be able to use CUDA and CUDNN.
- If you do have an NVIDIA GPU, you will need to install the appropriate NVIDIA drivers for your GPU. You can find the latest drivers on the NVIDIA website (https://www.nvidia.com/Download/index.aspx).
- Follow the instructions provided on the NVIDIA website to install the drivers.
Check the version here:
- Check here the version (https://www.tensorflow.org/install/so).
3. Microsoft Visual Studio:
- Check here (https://visualstudio.microsoft.com/vs/community/).
- Follow the instructions provided in the installer to install Visual studio on your system.
4. Install CUDA:
- Download the CUDA installer from the NVIDIA website (https://developer.nvidia.com/cuda-downloads).
- Follow the instructions provided in the installer to install CUDA on your system.
- Download the CUDNN installer from the NVIDIA website (https://developer.nvidia.com/rdp/cudnn-download).
- Follow the instructions provided in the installer to install CUDNN on your system.
- Install TensorFlow with GPU support by using the following command:
conda create --name tf_2.4 python==3.8 activate tf_2.4 pip install tensorflow-gpu
- Check here the compatibility version (https://pytorch.org/get-started/previous-versions/) or (https://pytorch.org/get-started/locally/)
- Install PyTorch with GPU support by using the following command:
#CUDA 11.3 pip install torch==1.12.1+cu113 torchvision==0.13.1+cu113 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu113 oR #CUDA 11.6conda install pytorch torchvision torchaudio pytorch-cuda=11.6 -c pytorch -c nvidia
Note: These instructions are for installing the latest versions of CUDA, CUDNN, TensorFlow, and PyTorch. If you want to install specific versions, you will need to specify the version numbers in the relevant commands.
Read more about: Classification model with Python code from Scratch