Categories
Machine Learning

Install Tensorflow run with GPU RTX in Windows 11

Note:

Please go to the latest update article here https://www.yodiw.com/fix-install-tensorflow-2-with-gpu-simple-version-2023/

Author

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 Python 3.7 – 3.10 for Windows. (I use Python 3.10.9)

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

Second step

Download the CUDNN via Conda and check the latest packages

conda search -c nvidia cudatoolkit
conda search -c nvidia cudnn
conda install -c conda-forge cudatoolkit=11.5.0 cudnn=8.2.1

Third step

Now, we are ready to install tensorflow (If you are using Python 3.11, you may have issue with tensorflow pip installation)

python -m pip install "tensorflow<2.11"

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

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

PS:
If not working, then install CUDA 11 at here https://developer.nvidia.com/cuda-toolkit

5 replies on “Install Tensorflow run with GPU RTX in Windows 11”

For GPU accelerated training you will need a dedicated GPU. Intel onboard graphics can’t be used for that purpose. However, you can switch to CPU

i have cuda tool kit 12.1 in visual studio 2022 and iam beginner and iam adding 2 number with c++/cuda code,when i run my code the error appears:The provided PTX was compiled with an unsupported toolchain
and even when u imstall cuda toolkit again and in viusall studio 2022 create a new project with cuda 12.1 temple runtime the defualt code is having the same error,plz help me i dont konw what to do

Leave a Reply

Your email address will not be published. Required fields are marked *