Ray W
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.

      Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

      Explore these features while you wait
      Complete general settings
      Bookmark and like published notes
      Write a few more notes
      Complete general settings
      Write a few more notes
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note No publishing access yet

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.

    Your account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Your team account was recently created. Publishing will be available soon, allowing you to share notes on your public page and in search results.

    Explore these features while you wait
    Complete general settings
    Bookmark and like published notes
    Write a few more notes
    Complete general settings
    Write a few more notes
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # WSL Environment Setup ## Purpose Typically, when **developing an AI accelerator**, we do not train the model weights from scratch; instead, **we leverage pre-trained parameters from established frameworks**. Our primary objective is to execute model inference to perform a **hardware-software co-validation**. Therefore, the software implementation must still be executed on high-performance GPUs. There are several ways to achieve the goal: * **Dedicated Linux Server** (Lab-provided or Self-built): While high-performing, this **requires managing a separate machine** or transitioning entirely to a Linux-based OS. As a Windows user, I find a complete OS switch disruptive to my established productivity workflow. * **Hyper-V with GPU-PV** (GPU Partitioning): This method allows resource sharing but is highly restrictive regarding hardware compatibility. **Consumer-grade laptop GPUs** (like the RTX 3060) typically **do not support this enterprise-level feature**. * **Hyper-V with DDA** (Discrete Device Assignment): DDA offers direct hardware access but follows a "winner-takes-all" model. Once the GPU is assigned to the VM, **the host Windows system loses its display and compute capabilities**, making multitasking impossible. * **WSL2** (Windows Subsystem for Linux) **with GPU Sharing**: WSL2 strikes the best balance. Although it introduces a marginal performance overhead compared to native Linux, it provides a seamless, shared-resource environment. It allows me to leverage powerful **Linux tools and Docker while retaining** the convenience of the **Windows ecosystem**. Given my hardware configuration—a laptop equipped with an **Intel i7-11800H CPU**, **Intel UHD Graphics**, and an **NVIDIA RTX 3060 GPU**—utilizing WSL2 is the most effective option for my development workflow. ## Steps 1. Upgrade to Windows 11 Pro to enable Hyper-V support. 2. Install WSL2 and set up an Ubuntu distribution. 3. Configure Docker Engine within the WSL2 environment. 4. Install NVIDIA Container Toolkit. 5. Integrate VS Code with Ubuntu, WSL, and Docker for a seamless development workflow. ## Windows 11 Pro My version is originally Windows 11 Home. To upgrade it, there are several ways. Here, I buy the **digital license** from the Microsoft store, which cost NT$ 3000. You can come to the settings below first. If you want to buy upgrade license, you can tap on the activation state and there will be an option linked to MS store. ![image](https://hackmd.io/_uploads/Bka8qMW6Wx.png) Unlike other activation methods, a Digital License is linked directly to your Microsoft account. This allows you to seamlessly transfer the upgrade to a new PC whenever you switch devices. ## Hyper-V, WSL2, Ubuntu ### Enable Hyper-V First, ensure that you are running **Windows 11 Pro** or **Windows 11 Enterprise**, as these versions are required to access advanced virtualization features like Hyper-V. Navigate to Optional features under the System settings, then click on **More Windows features**. From there, you will find the option to enable Hyper-V. After restarting the computer, Hyper-V will be fully enabled and ready for use. ![Screenshot 2026-04-18 225716](https://hackmd.io/_uploads/BJ1_nzba-l.png) ### Install WSL2 and Ubuntu You can reference to this video: https://youtu.be/PaEcQmgEz78?si=JIhHLIKHaS3aU1P8 1. To install WSL2, you will need to install the following two functions first. These two are **Virtual Machine Platform** and **Windows Subsystem for Linux**. ![image](https://hackmd.io/_uploads/rkBERf-abl.png) 2. Open the Command Prompt and run it as administrator. 3. Type the following cmd, then it will automatically install wsl2 and ubuntu for you. ``` wsl --install ``` 4. Type the following cmd, and you will find all the Linux Distribution (Distro). ``` wsl -list -v ``` ![image](https://hackmd.io/_uploads/Sk4UlmWTbe.png) 5. Because the Linux system is built on C drive, we want it to run at our D dive. We can run these cmds: ``` # you will find ubuntu.tar in your desktop. wsl --export Ubuntu ubuntu.tar # Create a folder in the D drive. Here, I named it as wsl2. # Ubuntu2 will be your system name. You can change it. wsl --import Ubuntu2 D:\wsl2 C:\Users\User\Desktop\ubuntu.tar # Set default Linux system to Ubuntu2 wsl --set-default Ubuntu2 # Remove the origin system named Ubuntu on the C drive wsl --unregister Ubuntu ``` 6. By clicking the Ubuntu2 figure, you will get into the linux system. ![image](https://hackmd.io/_uploads/ryHSEQ-6bl.png) ![image](https://hackmd.io/_uploads/ByucVQWTZl.png) 7. If you encounter this problem: ``` Error code: Wsl/Service/CreateInstance/ReadDistroConfig/WSL_E_DISTRO_NOT_FOUND ``` It is because it connected to the previous system named Ubuntu. You can solve this by clicking the setting button here. ![image](https://hackmd.io/_uploads/HJ58mob6-l.png) Go to the profile of "Ubuntu" and change the Command line to: ``` wsl.exe -d Ubuntu2 ``` The command-line profile should then automatically update its name to "Ubuntu2". 8. Quickly check basic functions ``` # You should see the result /home/USER_NAME pwd # It is used to check the disk space usage across all mounted file systems in a Linux environment. df -h # You can access to the datas in your drive. For example: I want to see the D drive. cd /mnt/d # By using the cmd below you can get back to home (or cd ~). cd # Check if wsl2 can detect your GPU nvidia-smi ``` ![image](https://hackmd.io/_uploads/SyruKj-TZg.png) If you close the Ubuntu2 terminal, the distribution may enter suspended mode to conserve system resources. You can shutdown the system by doing so: ``` wsl --shutdown ``` ## Install docker You can reference to this blog: https://blog.miniasp.com/post/2025/06/14/How-to-remove-Docker-Desktop-and-install-Docker-Engine-on-Windows-with-WSL-2 1. Install docker engine on wsl2 (instead of installing docker desktop): ``` # 1. Download the Docker installation script # Reference: https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script curl -fsSL https://get.docker.com -o get-docker.sh # 2. Execute the installation script # Note: The script may prompt you to install Docker Desktop. You may ignore it. sudo sh get-docker.sh # 3. Manage Docker as a non-root user by adding your account to the docker group # Reference: https://docs.docker.com/engine/install/linux-postinstall/#manage-docker-as-a-non-root-user sudo usermod -aG docker $USER # Note that you need to shutdown wsl2 to update this information. # 4. Verify your identity id $USER # 5. Verify the installation and check versions docker --version docker compose version ``` 2. Use **systemd** to control docker engine. Normally, systemd is enabled automatically. You should check it as follow: ``` # You may use vim to edit the file. Here, I used another method. # It is more user friendly. sudo nano /etc/wsl.conf # we need to check if it shows "[boot] systemd=true". ``` ![image](https://hackmd.io/_uploads/rJ8X_NQpZx.png) **Note: The `^` means crtl.** ``` # You can verify if the Docker service is properly registered using the following command: systemctl list-unit-files --type=service | grep docker # Note that you may use "q" to exit from the cmd above. # To check the real-time operational status of the Docker service, use: systemctl status docker.service ``` ## Install NVIDIA Container Toolkit Though we can access to our GPU on wsl2. We may not detect the GPU when using the docker on wsl2. So, we need to install the NVIDIA Container Toolkit. You can reference this github: https://gist.github.com/atinfinity/f9568aa9564371f573138712070f5bad 1. Install toolkit: ``` curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg && curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list && sudo apt-get update sudo apt-get install -y nvidia-container-toolkit ``` 2. Restart docker service to update: ``` sudo systemctl restart docker ``` 3. Run a sample to check if the toolkit works on docker: ``` docker run -it --rm --gpus all nvidia/cuda:11.8.0-base-ubuntu22.04 nvidia-smi ``` ## Connect wsl2 to VScode You may reference to MS website and the video: https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode https://youtu.be/R88B_ldc6O8?si=vu3zw-NDmVEjw89a 1. Install extension pack on VScode: ![image](https://hackmd.io/_uploads/ByeaRN7TWx.png) 2. Open ubuntu to install extension pack locally: ``` # Install essential networking and security tools sudo apt-get install wget ca-certificates # These tools ensure that: # 1. 'wget' can download files from the internet via command line. # 2. 'ca-certificates' allows the system to verify SSL/TLS connections (HTTPS). # Open up VScode on ubuntu # It may take a while for the first time. # The video install VScode server very fast. My situation is much more slower. It takes about 30 min? code . ``` ![image](https://hackmd.io/_uploads/SJEpgrX6-e.png) And install "Docker". ## Reference * https://youtu.be/PaEcQmgEz78?si=JIhHLIKHaS3aU1P8 * https://blog.miniasp.com/post/2025/06/14/How-to-remove-Docker-Desktop-and-install-Docker-Engine-on-Windows-with-WSL-2 * https://gist.github.com/atinfinity/f9568aa9564371f573138712070f5bad * https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode * https://youtu.be/R88B_ldc6O8?si=vu3zw-NDmVEjw89a

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password
    or
    Sign in via Google Sign in via Facebook Sign in via X(Twitter) Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    By signing in, you agree to our terms of service.

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully