Skip to content

owaismujtaba/Tensorflow-GPU2.9.0-on-ubuntu-20.04-LTS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

Tensorflow-GPU2.9.0-on-ubuntu-20.04-LTS

To setup a GPU- Supportfor Nvidia and Tensor flow you need these things

  1. You should have nvidia device drivers installed.

  2. Check nvidia-smi it should be working.if it is not working dont worry follow the steps Screenshot from 2022-08-16 13-03-58

  3. You need to downlod CUDA and cuDNN

  4. Before downloading CUDA and cuDNN check for the comptability with the tensorflow version

  5. Screenshot from 2022-08-16 13-08-05

  6. Here will be installing tensorflow 2.9.0 so we need to download CUDA 11.2 and cuDNN 8.1

  7. Go to https://developer.nvidia.com/cuda-downloads then archive or directly to https://developer.nvidia.com/cuda-toolkit-archive

  8. Select the version thatis 11.2 we will click on 11.2.2 which is the ist as in

  9. Screenshot from 2022-08-16 13-15-47

  10. Select Linux then x86 then ubuntu then 20.04 then run file you will get the two steps as below

  11. Screenshot from 2022-08-16 13-11-54

  12. Exectute these two in your ubuntu shell. The first one will download the file and second one for installation.

  13. Wait for the menu to pop up and continue the type accept.

  14. Screenshot from 2022-08-16 13-18-59

  15. if your nvidia-smi was not working the check the Driver and CUDA Toolkit11.2. you do not need Samples Demo Suite and Documentation

  16. Screenshot from 2022-08-16 13-21-50

  17. You now have CUDA installed and now you need cuDNN

  18. Download cuDNN from this https://developer.nvidia.com/rdp/cudnn-archive

  19. Select the compatible version for tensorflow2.9 we need 8.1

  20. Screenshot from 2022-08-16 13-24-46

  21. Click on the link and download the for Linux(x86_64) if you have 64. A tar file will be download

  22. Unzip the tar file by thefollowing command

  23. tar -xvf file_name

  24. Screenshot from 2022-08-16 13-26-26

  25. You will now have a cuda folder in created in the current directory and the files are extracted there

  26. Type these three commands but remeber to check you have cuda folder in you current directory.

  27. sudo cp cuda/include/cudnn*.h /usr/local/cuda/include

  28. sudo cp -P cuda/lib64/libcudnn* /usr/local/cuda/lib64

  29. sudo chmod a+r /usr/local/cuda/include/cudnn*.h /usr/local/cuda/lib64/libcudnn*

  30. open .bashrc file using nano

  31. nano ~/.bashrc

  32. add these two lines at the end of the file

  33. export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}$

  34. export LD_LIBRARY_PATH=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

  35. save it and close it.

  36. Restart the terminal and check

  37. nvidia-smi

  38. nvcc -V

  39. both shod be working

  40. Screenshot from 2022-08-16 13-31-18

  41. now create an python environment

  42. sudo apt-get install -y python3-pip

  43. sudo apt-get install -y python3-venv

  44. python -m venv environemnt_name

  45. activate your environment

  46. source environment_name/bin/activate

  47. using pip install tensorflow-gpu 2.9.0

  48. pip install tensorflow-gpu==2.9.0

  49. now you have tensorflow-gpu2.9.0 CUDA 11.2 and cuDNN 8.1 installed

  50. wile installing tensorflow-gpu you might get the error of protobuf version comptability issue

  51. Solve that using

  52. pip install --upgrade protobuf==3.11

  53. That is all

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published