Skip to content

Instantly share code, notes, and snippets.

@salilsaxena
Last active July 4, 2024 16:53
Show Gist options
  • Save salilsaxena/d511e8c711381003e006599997c0ba6d to your computer and use it in GitHub Desktop.
Save salilsaxena/d511e8c711381003e006599997c0ba6d to your computer and use it in GitHub Desktop.
CUDA + CuDNN install in Fedora/Ubuntu for Tensorflow-gpu guide.

We will not be using anacond, just classic old pip3
Works on python <= 3.8
Recomended OS: Fedora29(Have reached End of Life), Ubuntu 18.04(End of life: 2023). You can also use Later versions of same OS.
Step 1:
 Install Nvidia Propiatary Drivers:
  For ubuntu: link[https://medium.com/@redowan/no-bullshit-guide-on-installing-tensorflow-gpu-ubuntu-18-04-18-10-238924cc4a6a]. //Just follow the part where he shows how to install drivers.
  For Fedora using optimus: link[https://www.reddit.com/r/Fedora/comments/ga1ek6/optimus_setting_the_nvidia_gpu_as_primary/]. I personally stopped before Step 8(in tutorial).
 I know they are Lenghty process(may require several Reboots, but stay with me.
Step 2:
 Install Cuda10.1 for tf2.2 and tf1.15{only for python<3.8}, using this link1[https://developer.nvidia.com/cuda-10.1-download-archive-base?target_os=Linux]. A local .deb/.rpm method is recomended.
Step 3:
 Install Cudnn:
  You have a create an account before downloading it.
  Download and extract cudnn Library from link2[https://developer.nvidia.com/rdp/cudnn-archive].
   Click on the option 'Download cuDNN v7.6.4 (September 27, 2019), for CUDA 10.1'>'cuDNN Library for Linux'
   Best install Instructions: link3[https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html#installlinux-tar]. Follow Section 2.3.1
  Download and install Runtime+Developer+Code Samples Libraries from link4[https://developer.nvidia.com/rdp/cudnn-archive].
  If you are having trouble, refer lin3 section 2.3.2/2.3.3
Step 3:
 Test the code using Cudnn Code Sample Library:
  Only avliable for Fedora29/Ubuntu18.04.
  Follow link3 section 2.4.
Step 4:
 Install Tensorflow and then Keras. To avoid version clashes between them follow[https://docs.floydhub.com/guides/environments/]
 Make a simple CNN or copy it from link5[https://github.com/keras-team/keras/blob/master/examples/mnist_cnn.py]
 The Speedup must be great{make a virtualenv and install tf-cpu on it and compare OR run the same of Colab(CPU runtime)}
Hope this guides helps. I have used this guide on several Machines, I am also running on my current machine(Fedora32) and it runns Flawlessly.

Any suggestions or questions are welcomed.

Bonus Tip: export TF_CPP_MIN_LOG_LEVEL='2' copy this into your .dot files of terminal emulator to remove all the log message output('1') and warnings('2'), somtimes they can really disturb your workflow.

Thank You.

@mbledkowski
Copy link

@dantetemplar
Copy link

Nvidia removed tar installation instructions. Here is a backup - http://web.archive.org/web/20220520235723/https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html

oh my Lord, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment