<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Aunuun Jeffry Mahbuubi on Medium]]></title>
        <description><![CDATA[Stories by Aunuun Jeffry Mahbuubi on Medium]]></description>
        <link>https://medium.com/@jeffrymahbuubi?source=rss-7655192ecfb7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*HYWaB86JTzcoaSLJZ34bew.jpeg</url>
            <title>Stories by Aunuun Jeffry Mahbuubi on Medium</title>
            <link>https://medium.com/@jeffrymahbuubi?source=rss-7655192ecfb7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 20:07:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jeffrymahbuubi/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Install NVIDIA, CUDA, and cuDNN for Ubuntu 20.04]]></title>
            <link>https://medium.com/@jeffrymahbuubi/install-nvidia-cuda-and-cudnn-for-ubuntu-20-04-c1faebd6bbf6?source=rss-7655192ecfb7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c1faebd6bbf6</guid>
            <category><![CDATA[nvidia-gpu]]></category>
            <category><![CDATA[cudnn]]></category>
            <category><![CDATA[tensorflow-gpu]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[cuda-toolkit]]></category>
            <dc:creator><![CDATA[Aunuun Jeffry Mahbuubi]]></dc:creator>
            <pubDate>Sun, 26 May 2024 07:35:25 GMT</pubDate>
            <atom:updated>2025-05-02T08:34:37.940Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t81ErNkDyMGWKI83" /><figcaption>Photo by <a href="https://unsplash.com/@6heinz3r?utm_source=medium&amp;utm_medium=referral">Gabriel Heinzer</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Table of Contents</strong></p><p>· <a href="#fe99">1. Overview</a><br>· <a href="#7f22">2. Delete existing driver related to NVIDIA, CUDA, and cuDNN</a><br>· <a href="#ff53">3. Install CUDA Toolkit</a><br>· <a href="#15b9">4. Install cuDNN </a><br>· <a href="#bb1d">5. Check if Tensorflow can recognize the NVIDIA GPU</a></p><h3>1. Overview</h3><p>This guide serves as a personal reference for setting up an NVIDIA GPU environment for deep learning tasks using TensorFlow on Ubuntu 20.04.</p><p>Even though I followed numerous guides from other Medium posts and various sources, I encountered several issues when setting up the NVIDIA GPU environment on Ubuntu 20.04. While the easiest way to configure a GPU environment for TensorFlow is by using Docker, there are situations where we need to enable NVIDIA directly on our machine, such as when preparing for the TensorFlow Developer Certificate Examination.</p><p>The main primary challenge often lies in installing cuDNN, especially when a specific version is required. In this case, I needed to installTensorflow=2.13.0 , which, according to the <a href="https://www.tensorflow.org/install/source#tested_build_configurations">official documentations</a> requires CUDA=11.8 and cuDNN=8.6.0</p><h3>2. Delete existing driver related to NVIDIA, CUDA, and cuDNN</h3><pre># Remove NVIDIA Driver<br>sudo apt-get --purge remove &quot;*nvidia*&quot;<br><br># Remove CUDA Toolkit<br>sudo apt-get --purge remove &quot;cuda*&quot;<br><br># Remove cuDNN Packages<br>sudo apt-get --purge remove libcudnn8 libcudnn8-dev libcudnn8-samples<br>sudo apt-get --purge remove libcudnn7 libcudnn7-dev libcudnn7-doc  # if you have older versions<br><br># Manually Remove Any Remaining CUDA and cuDNN Files:<br>sudo rm -rf /usr/local/cuda*<br>sudo rm -rf /usr/local/include/cudnn*<br>sudo rm -rf /usr/local/lib64/libcudnn*<br>sudo rm -rf /usr/local/bin/cuda*<br>sudo rm -rf /usr/local/bin/nvcc*<br>sudo rm -rf /usr/local/share/cuda*<br>sudo rm -rf /usr/local/share/nvcc*<br><br># Clean Up Package Lists:<br>sudo apt-get autoremove<br>sudo apt-get autoclean<br><br># Reboot the system<br>sudo reboot</pre><h3>3. Install CUDA Toolkit</h3><p>If you want to install particular version of CUDA, click this <a href="https://developer.nvidia.com/cuda-toolkit-archive">link</a>. Choose the appropriate system; in my case I choose to install on Linux for x86 architecture, Ubuntu distributions, version 20.04 I recommend using the <strong>runfile (local) </strong>as the mode of installation. Follow the installation instructions, and a GUI terminal will appear. Select to install theDriver, CUDA Toolkit , CUDA DEMO Suite , and CUDA Documentation as shown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*8MGjkslSOJd91tc_xO1ldA.jpeg" /></figure><p>This will install NVIDIA driver and CUDA. If you see a message saying An NVIDIA driver was detected it means that the driver removal wasn’t successful. You need to ensure the driver is properly removed and repeat the removal process.</p><h3>4. Install cuDNN</h3><p>If you want to install a particular version of cuDNN, click this <a href="https://developer.nvidia.com/rdp/cudnn-archive">link</a> which leads to the driver archive of cuDNN. In my case I choose 8.6.0 for CUDA 11.x I download the `<a href="https://developer.nvidia.com/compute/cudnn/secure/8.6.0/local_installers/11.8/cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_amd64.deb">Local Installer for Ubuntu20.04 x86_64 (Deb)</a>` to the Downloads folder on my system.</p><p>Initially I follow the official guide installation from NVIDIA <a href="https://docs.nvidia.com/deeplearning/cudnn/latest/installation/linux.html">here</a>. However since I wanted to install a specific version of cuDNN, the guide might not work as it suggests using sudo apt-get -y install cudnn9-cuda11 This confused me because running this command didn’t work, indicating that the package was not found.</p><p>Therefore, I manually unpacked the .deb package and manually copied all the necessary files to thecuda and cuda-11.8 folders located inusr/local directory. Follow these steps to proceed:</p><pre># Step 1: Extract Header Files from the `.deb` package<br># Enable the local repository<br>sudo dpkg-i cudnn-local-repo-ubuntu2004-8.6.0.163_1.0-1_amd64.deb<br><br># Navigate to the directory where the .deb package is located:<br>cd /var/cudnn-local-repo-ubuntu2004-8.6.0.163<br><br># Extract the header files from the .deb package for cudnn:<br>mkdir -p cudnn-extracted<br>sudo dpkg-deb -x libcudnn8-dev_8.6.0.163-1+cuda11.8_amd64.deb cudnn-extracted/<br><br># Copy the header files of cudnn to the CUDA include directory:<br>sudo cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-extracted/usr/include/x86_64-linux-gnu/cudnn*.h /usr/local/cuda/include/<br>sudo cp /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-extracted/usr/include/x86_64-linux-gnu/cudnn*.h /usr/local/cuda-11.8/include/<br><br># Extract the header files from the .deb package for libcudnn:<br>mkdir -p cudnn-runtime-extracted<br>sudo dpkg-deb -x libcudnn8_8.6.0.163-1+cuda11.8_amd64.deb cudnn-runtime-extracted/<br><br># Copy the header files of libcudnn to the CUDA include directory:<br>sudo cp -P /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-runtime-extracted/usr/lib/x86_64-linux-gnu/libcudnn* /usr/local/cuda/lib64/<br>sudo cp -P /var/cudnn-local-repo-ubuntu2004-8.6.0.163/cudnn-runtime-extracted/usr/lib/x86_64-linux-gnu/libcudnn* /usr/local/cuda-11.8/lib64/<br><br># Step 2: Set Permissions<br>sudo chmod a+r /usr/local/cuda/include/cudnn*.h<br>sudo chmod a+r /usr/local/cuda-11.8/include/cudnn*.h<br>sudo chmod a+r /usr/local/cuda/lib64/libcudnn*<br>sudo chmod a+r /usr/local/cuda-11.8/lib64/libcudnn*</pre><p>Verify cuDNN installation</p><pre>cat /usr/local/cuda/include/cudnn_version_v8.h | grep CUDNN_MAJOR -A 2<br>cat /usr/local/cuda-11.8/include/cudnn_version_v8.h | grep CUDNN_MAJOR -A 2</pre><p>You need to get output similar like this,</p><blockquote>#define CUDNN_MAJOR 8<br>#define CUDNN_MINOR 6<br>#define CUDNN_PATCHLEVEL 0<br> — <br>#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)</blockquote><blockquote>/* cannot use constexpr here since this is a C-only file */</blockquote><p>If you don’t get the expected output, it means that the cuDNN files can’t be found in the cuda and cuda-11.8 folder. To verify, navigate to/usr/local/cuda/include and manually check the directory using ls command. You should see header files related to cuDNN, such as cudnn*.h</p><h3>5. Check if Tensorflow can recognize the NVIDIA GPU</h3><pre>import tensorflow as tf<br><br>print(&quot;TensorFlow version:&quot;, tf.__version__)<br>print(&quot;Num GPUs Available: &quot;, len(tf.config.experimental.list_physical_devices(&#39;GPU&#39;)))</pre><p>You should get Num GPUs Available: 1 which indicates that the installation is successful.</p><p>By following these steps, you should have successfully set up your NVIDIA GPU environment with CUDA and cuDNN on Ubuntu 20.04. This configuration will enable you to efficiently run TensorFlow for your deep learning projects. Remember, while the process can seem complex, taking the time to correctly install and configure these tools will save you time and trouble in the long run. Should you encounter any issues, revisit each step to ensure all components are properly installed. Happy coding, and good luck with your deep learning endeavors!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c1faebd6bbf6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>