<?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 Ethan X. Mao on Medium]]></title>
        <description><![CDATA[Stories by Ethan X. Mao on Medium]]></description>
        <link>https://medium.com/@xizengmao?source=rss-25fd8654d79e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*z59TQfrGED-WaFLuz-eGDQ@2x.jpeg</url>
            <title>Stories by Ethan X. Mao on Medium</title>
            <link>https://medium.com/@xizengmao?source=rss-25fd8654d79e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 07:55:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@xizengmao/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 TensorFlow with GPU Acceleration Simultaneously for Windows and WSL Linux (2)]]></title>
            <link>https://medium.com/@xizengmao/install-tensorflow-with-gpu-acceleration-simultaneously-for-windows-and-wsl-linux-2-10da088d5e4f?source=rss-25fd8654d79e------2</link>
            <guid isPermaLink="false">https://medium.com/p/10da088d5e4f</guid>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <dc:creator><![CDATA[Ethan X. Mao]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 04:24:37 GMT</pubDate>
            <atom:updated>2022-01-29T04:26:08.770Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*I3c5-ylKbj7k9Rx5pRIsoQ.png" /><figcaption>Logo pictures from the official websites of TensorFlow, NVIDIA and Ubuntu websites</figcaption></figure><p>In the previous post of the series, I showed you how to install Nvidia CUDA-enabled Display Driver for Both Windows and WSL and then TensorFlow with GPU support on Windows. I hope you have enjoyed the GPU-enabled acceleration of TensorFlow for Windows in your deep learning data analysis. In this post, I will show you how to bring the same capacity to WSL 2 so that you can enjoy native GPU acceleration in your WSL 2 Linux environment. Remember we have already installed the universal Nvidia CUDA-enabled Display Driver shared by both Windows and WSL 2 in the previous post, I will start with the installation of Nvidia CUDA Toolkit and cuDNN Library.</p><h3>Install TensorFlow with GPU support for WSL2</h3><p>Similar to Tensorflow installation on Windows, you need to first install Nvidia CUDA toolkit 11.2.0 and cuDNN Library 8.1.1 and then install Python, Tensorflow, and its dependent packages. I assume you already have WSL 2 Ubuntu 20.04 available on your computer; otherwise, you need first install WSL2 Ubuntu by referring the guide on the official website (<a href="https://docs.microsoft.com/en-us/windows/wsl/install">https://docs.microsoft.com/en-us/windows/wsl/install</a>) or Medium website. The installation is straightforward and applicable as well for the other WSL2 Linux editions, and I won’t go into detail in this post. Here is my WSL 2 Ubuntu setup as shown in Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aARwiPAY2E1XammT8NCkCw.png" /><figcaption>Figure 1. WSL2 Ubuntu 20.04 LTS.</figcaption></figure><h3>Install Nvidia CUDA Toolkit and cuDNN Library on WSL 2</h3><p>Nvidia CUDA toolkit 11.2.0 for WSL2 Ubuntu can be downloaded from the Nvidia website, <a href="https://developer.nvidia.com/cuda-11.2.0-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;target_distro=WSLUbuntu&amp;target_version=20">https://developer.nvidia.com/cuda-11.2.0-download-archive?target_os=Linux&amp;target_arch=x86_64&amp;target_distro=WSLUbuntu&amp;target_version=20</a>. There are 3 installer types:</p><ul><li><strong><em>run file (local)</em></strong>, is self-contained and include every components</li><li><strong><em>deb (local)</em></strong>, is Ubuntu native package format and to first save the package locally and install the packages from the local packages</li><li><strong><em>deb (network)</em></strong>, is Ubuntu native package format and to install the packages on the fly without saving the packages locally.</li></ul><p>I chose the format of “<strong>deb (network)</strong>”, and you may also use any other favorite format to install as instructed on the website above. Copy and paste the following commands into WSL 2 Ubuntu terminal window to download and install the packages of Nvidia CUDA toolkit and cuDNN library using Ubuntu package manager:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7a31796b9717f967691929633c73fa87/href">https://medium.com/media/7a31796b9717f967691929633c73fa87/href</a></iframe><p>To install the cuDNN Library 8.1.1, copy and paste the following commands into WSL2 Ubuntu terminal window to download and install the needed packages automatically:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69559ff614d21670efd8bf9ce514498a/href">https://medium.com/media/69559ff614d21670efd8bf9ce514498a/href</a></iframe><h4>Install Python and TensorFlow v2.7</h4><p>I chose Python 3 bundled with Ubuntu, and you can choose Anaconda as well. First, I installed python3 and dependent packages using Ubuntu package manager <strong><em>apt</em></strong>, and Tensorflow using Python package manager <strong><em>pip</em></strong>.</p><p>Copy and paste the following commands into WSL2 Ubuntu terminal windows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3efb5f05e40f5b1c99459d4ede569102/href">https://medium.com/media/3efb5f05e40f5b1c99459d4ede569102/href</a></iframe><h4>Verify TensorFlow with GPU support</h4><p>Congrats! You have finally installed Tensorflow with GPU support for WSL2 Ubuntu Linux. You may verify if GPU works by the following commands:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b059f3c38f283b28b707f3d95855ec9b/href">https://medium.com/media/b059f3c38f283b28b707f3d95855ec9b/href</a></iframe><p>If you see the information of any available GPU, the installation is successful. Mine is</p><pre>[PhysicalDevice(name=’/physical_device:GPU:0&#39;, device_type=’GPU’)]</pre><h3>References</h3><ol><li><a href="https://blogs.windows.com/windowsexperience/2021/07/15/introducing-the-next-feature-update-to-windows-10-21h2/">https://blogs.windows.com/windowsexperience/2021/07/15/introducing-the-next-feature-update-to-windows-10-21h2/</a></li><li>Enable NVIDIA CUDA on WSL 2, <a href="https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl">https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10da088d5e4f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install TensorFlow with GPU Acceleration Simultaneously for Windows and WSL Linux (1)]]></title>
            <link>https://medium.com/@xizengmao/install-tensorflow-with-gpu-acceleration-simultaneously-for-windows-and-wsl-linux-1-5b8ccc5ea426?source=rss-25fd8654d79e------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b8ccc5ea426</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[gpu-computing]]></category>
            <category><![CDATA[wsl]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Ethan X. Mao]]></dc:creator>
            <pubDate>Sat, 29 Jan 2022 04:20:08 GMT</pubDate>
            <atom:updated>2022-01-29T04:20:08.800Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*IS8iZpctRakw7Dm3LJz1yg.png" /><figcaption>Logo pictures from the official websites of TensorFlow, NVIDIA and Ubuntu.</figcaption></figure><p>Windows 10 21H2 and 11 have officially supported native GPU acceleration for WSL 2 (Windows Subsystem Linux). Now it’s time to install TensorFlow with GPU support simultaneously on both Windows and WSL 2 so that you can choose your favorite computing environment for daily deep learning analysis.</p><p>The key to success is to choose the compatible hardware and software dependencies along with Tensorflow, as shown in Table 1. You can always check if there is any change for the required hardware and softwares on its official website (<a href="https://www.tensorflow.org/install/gpu">https://www.tensorflow.org/install/gpu</a>). In this post, I’ll show you step by step how to install TensorFlow v2.7 with compatible hardware and softwares to enable GPU support on both Windows and WSL 2 environments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*O20_KOM087qo0xyiY2sNSQ.png" /></figure><h3>Check Your Hardware and OS</h3><p>I am using Dell T5600 Workstation with Nvidia Quadro K2200, and you can choose any other workstation or laptop with a compatible GPU (mostly Nvidia graphic card). I focus on Windows 10 (v21H2 or later) and WSL2 Ubuntu Linux 20.04, as native GPU support for TensorFlow currently works on Windows and Linux, while it’s not yet available natively on macOS. Your Windows needs to be Windows 10 21H2 or later, as shown in Figure 1 by <strong>Settings &gt; Update &amp; Security &gt; OS Build Info</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EyJNg0t4rYS3PjzJCmzFHw.png" /><figcaption>Figure 1. Windows OS Build Info, 21H2 is needed.</figcaption></figure><h3>Install Nvidia CUDA-enabled Driver for WSL 2 and Windows</h3><p>Nvidia CUDA-enabled Driver serves as the universal component to access GPU capability at OS kernel level, on both Windows and WSL 2. It’s vital to install the correct version that works on both Windows and WSL 2. Go to <a href="https://developer.nvidia.com/cuda/wsl/download">https://developer.nvidia.com/cuda/wsl/download</a>, and click “Geforce Driver” or “Quadro Driver” based on your Nvidia card to download the driver.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IvrlrllAa8bVKKogbmsXwg.png" /><figcaption>Figure 2. Download Nvidia CUDA-enabled Driver for WSL and Windows from the Nvidia website.</figcaption></figure><p>My downloaded file is <em>510.06_quadro_win11_win10-dch_64bit_international.exe</em>, and yours may have a different version name when a newer version is available. Double-clicking starts the installation with self-extraction (Figure 3) into <strong><em>C:\NVIDIA\DisplayDriver\510.06\Win11_Win10-DCH_64\International</em></strong>. Once the extraction is done, it starts the installation automatically. You can finish the following installation by just selecting “Express” (Figure 4). My currently installed driver is v510.06 as shown in Figure 5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/396/1*noXq3vDFkDDkayEMWBtqGw.png" /><figcaption>Figure 3. Dialog of self-extraction of Nvidia Display Driver installation</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*4A8Zt0AygUgkjC9-fh2l3w.png" /><figcaption>Figure 4. Options to install Nvidia Graphics Driver.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/594/1*wbJR-XpNl6UcvXtwzcSWfA.png" /><figcaption>Figure 5. Installed Nvidia Graphics Driver.</figcaption></figure><p>Congrats! We have finished the first solid step. Next, I’ll install TensorFlow with GPU support first on Windows, then on WSL 2. If you only want WSL 2 set up, you can skip the following section. Tensorflow accesses GPU compute capability over Nvidia CUDA Toolkit and cuDNN Library, and hence the key to installation success is to choose compatible versions of these two packages with TensorFlow. At the time of this post, the latest stable version of TensorFlow is 2.7.0, and CUDA Toolkit 11.2 and cuDNN SDK 8.1.0 are necessary for it to function.</p><h3>Install TensorFlow with GPU support for Windows 10</h3><h4>Install Microsoft Visual Studio, Nvidia CUDA Toolkit, and cuDNN Library</h4><p>Nvidia CUDA depends on Microsoft Visual Studio to compile CUDA-enabled code when needed. At the time of this post, the 2019 Community Edition is compatible with Nvidia CUDA Toolkit and can be downloaded from <a href="https://visualstudio.microsoft.com/vs/older-downloads/">https://visualstudio.microsoft.com/vs/older-downloads/</a>. If you want to save disk space, select the “Desktop development with C++” and “.NET desktop development” components to make Nvidia CUDA, as shown in Figure 6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JIaASFRL_aYkWQ-J2O3aLw.png" /><figcaption>Figure 6. Dialog of installation option for Microsoft Visual Studio 2019 Community Edition.</figcaption></figure><p>You can download Nvidia CUDA Toolkit 11.2 and cuDNN Library 8.1 for Windows 10 shown in the following list. You may get the higher minor versions instead of 11.2.<strong><em>0</em></strong> and 8.1.<strong><em>1</em></strong> I got, which should be still compatible just if they match the major version numbers 11.2 and 8.1 respectively.</p><ul><li>Nvidia CUDA Toolkit 11.2.0 for Windows 10 X86_64 (<a href="https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.89_win10.exe">https://developer.download.nvidia.com/compute/cuda/11.2.0/local_installers/cuda_11.2.0_460.89_win10.exe</a>)</li><li>Nvidia cuDNN Library v8.1.1 for CUDA 11.0, 11.1 and 11.2, for Windows 10 x86_64 (<a href="https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-windows-x64-v8.1.1.33.zip">https://developer.nvidia.com/compute/machine-learning/cudnn/secure/8.1.1.33/11.2_20210301/cudnn-11.2-windows-x64-v8.1.1.33.zip</a>)</li></ul><p>Once the downloading is complete, double click cuda_11.2.0_460.89_win10.exe to start the installation. Be aware to choose the installation option of “Custom (Advanced)” and uncheck the Display Driver and HD audio to <strong>avoid </strong>overriding the graphic driver installed above, as in Figure 7.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*vrPwH4EQXecTrrkCpjopeg.png" /><figcaption>Figure 7. Dialog of custom installation options of Nvidia CUDA Toolkit.</figcaption></figure><p>Next, you download and unzip <em>cudnn-11.2-windows-x64-v8.1.1.33.zip </em>from the website shown in the above list, and copy the 3 sub-folders, <strong><em>bin, include and lib</em></strong>, into the installation folder of CUDA Toolkit, which is <strong><em>C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\</em></strong> by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*uQSRkldUkTAsdExE6aFwEg.png" /><figcaption>Figure 8. Installation of Nvidia cuDNN Library.</figcaption></figure><h4>Install Anaconda with Tensorflow v2.7</h4><p>We have installed all the GPU-relevant components and are now ready to install Python and TensorFlow. I choose Anaconda Individual Edition (<a href="https://www.anaconda.com/products/individual">https://www.anaconda.com/products/individual</a>) as my Python environment, as it preinstalls many popular packages and can install easily on-demand packages from its Conda package repository. Installation is straightforward with default options. Once the installation is done, start Anaconda-aware CMD or Powershell from <strong><em>Start Menu &gt; Anaconda3 &gt; Anaconda Powershell Prompt (anaconda3)</em></strong>.</p><p>I installed Tensorflow and dependent packages in a new Conda environment, namely <strong><em>ds</em></strong>. I install the dependent packages as possible first using Conda, and then TensorFlow using use <strong><em>Pip</em></strong>, just because TensorFlow in Conda currently depends on the incompatible CUDA Toolkit (v11.3.1) and cuDNN Library (v8.2.1.32). I hope that the Conda maintainers for Tensorflow will fix the incompatibility issue in the future, which makes the installation much easier. The commands are shown as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbdf6fc352f5be793b571f7b558f20c6/href">https://medium.com/media/dbdf6fc352f5be793b571f7b558f20c6/href</a></iframe><h4>Verify TensorFlow with GPU support</h4><p>You finally have installed Tensorflow with GPU support for Windows 10. You may verify if GPU works by the following commands:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/996923a546ea49d2f6ccb6c9240e3c10/href">https://medium.com/media/996923a546ea49d2f6ccb6c9240e3c10/href</a></iframe><p>If you see the information of any available GPU, the installation is successful. Mine is</p><pre>[PhysicalDevice(name=’/physical_device:GPU:0&#39;, device_type=’GPU’)]</pre><p>Cheers! You can now enjoy and use the GPU-enabled acceleration of deep learning on Windows. You are welcome to share the feedback with me on Medium. I am more than happy to read and answer. In the next post of the series, I’ll show you step by step how to install Tensorflow with GPU support on WSL2 Ubuntu Linux 20.04!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b8ccc5ea426" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>