Categories
Machine Learning

Install Tensorflow, CUDA,Visual Studio 2022 in Windows 11 for GPU modelling

This tutorial will help you to run Tensorflow in Windows 11 to use GPU for modelling, with the latest Visual Studio, CUDA and latest drivers. In this case, I’m using RTX 3060Ti Lite Hashes and latest Python for Windows.

TLDR;

We need to install

  • Clean Windows Installation and GPU drivers card
  • the Microsoft Visual C++ (MSVC) compiler 2022
  • the CUDA Toolkit 11.8
  • the cuDNN libraries
  • Install tensorflow

Pre-requisites

1. Windows fresh installation to remove the complexity of issues or bugs is recommended here. I did re-install my Windows 11 in this step

2. Instead of using Nvidia Geforce Experience, I uninstall the GPU drivers (back to Microsoft Basic) and use NVCleanstall to download my RTX 3060 drivers without others bloatware https://www.techpowerup.com/download/techpowerup-nvcleanstall/

3. I use Python 3.9 from Anaconda https://www.anaconda.com/products/distribution

First step

We need to install Microsoft Visual Studio 2022, which it will required by CUDA for integration. You can download the community version and check for C/C++ development installation

https://learn.microsoft.com/en-us/visualstudio/releases/2022/compatibility

Once its already installed in your desktop, then go for next step for install CUDA 11 (the latest version for Windows)

https://developer.nvidia.com/cuda-toolkit

When you completed this step, its halfway done!

Second step

Download the CUDNN https://developer.nvidia.com/rdp/cudnn-download and use the latest version. Then extract the zip files and copy the contents following to

cuda\bin\cudnn*.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin.

cuda\include\cudnn*.h to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\include.

cuda\lib\x64\cudnn*.lib to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\lib\x64.

Third step

Now, we are ready to install tensorflow

pip install tensorflow-gpu

Now, you can test the tensorflow now working using GPU RTX Nvidia.

python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

Leave a Reply

Your email address will not be published.