<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Virtualization on Charlie Chiang's blog</title><link>https://charlie0129.github.io/blog/categories/virtualization/</link><description>Recent content in Virtualization on Charlie Chiang's blog</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Sat, 16 Aug 2025 20:49:00 +0800</lastBuildDate><atom:link href="https://charlie0129.github.io/blog/categories/virtualization/index.xml" rel="self" type="application/rss+xml"/><item><title>Proxmox VE Shared GPU Installation Guide</title><link>https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/</link><pubDate>Sat, 16 Aug 2025 20:49:00 +0800</pubDate><guid>https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/</guid><description>&lt;h2 id="introduction">Introduction
&lt;/h2>&lt;p>Most schools and universities in China have a limited number of GPU servers (often only one or two, or even none). This makes the management of GPU development machines quite different than corporation which have virtually unlimited GPU servers.&lt;/p>
&lt;p>Let&amp;rsquo;s consider a normal lab environment with 12 students, each needing a GPU server for their projects, and we have one GPU server with 8 GPUs available.&lt;/p>
&lt;ul>
&lt;li>If we give each student a dedicated GPU server, we would need 12 servers, this is impractical and costly.&lt;/li>
&lt;li>If we let all the students share a single GPU server (all students have access to all resources), it would be very difficult to manage, as each student would need to install their own software and dependencies, leading to conflicts. Soon the GPU server will become a hot mess. Making each student use a different user account would not solve the problem, as they would still share the same OS and software environment, and will potentially break each other&amp;rsquo;s environment.&lt;/li>
&lt;li>If we make use of IOMMU and PCIe passthrough, we can assign a virtual machine with one dedicated passthrough&amp;rsquo;d GPU to each student. This approach has almost no interference between students, as each student has their own OS and software environment, even with it&amp;rsquo;s own GPU. However, this leads to a lot of wasted resources, because most of the time the GPU is idle, and each student will only have access to one GPU at a time, even if all of the GPUs are idle.&lt;/li>
&lt;li>If we use GPU virtualization, we can assign a virtual machine with a shared GPU to each student. This way, each student can use the GPU resources as needed, and the GPU can be shared among multiple students. This approach is more efficient and cost-effective, as it allows for better resource utilization. However, it requires a GPU that supports virtualization, such as NVIDIA&amp;rsquo;s vGPU or AMD&amp;rsquo;s MxGPU. Most consumer GPUs do not support virtualization, so this approach is not feasible for most schools and universities.&lt;/li>
&lt;/ul>
&lt;p>This is where containerization comes in. By using containerization, we can create a shared GPU development server that runs a container for each student. Each container can have its own software environment, and all (or some of) of the GPUs can be shared among multiple containers. This approach is more efficient and cost-effective, as it allows for better resource utilization, and does not require a GPU that supports virtualization. However, it should be noted that this approach is not as isolated as virtual machines, as all containers share the same kernel and GPU resources. Therefore, it is important to ensure that the containers are properly configured, and that the students are aware of the limitations and potential issues that may arise from sharing the same GPU resources (for example, if one student runs a GPU-intensive task, it may affect the performance of other students&amp;rsquo; containers).&lt;/p>
&lt;p>We will be using the CT (LXC Containers) in Proxmox VE to achieve this. Why not use Docker? Because Docker is meant for running applications, not for running full Linux distros. Although you can use something like sysbox to run a full Linux distro in Docker, i would still prefer to use LXC Containers, as they are built for this purpose and are already built into Proxmox VE, making it easier to manage and deploy.&lt;/p>
&lt;h2 id="proxmox-ve-installation">Proxmox VE Installation
&lt;/h2>&lt;p>Download the latest Proxmox VE ISO from the &lt;a class="link" href="https://www.proxmox.com/en/downloads" target="_blank" rel="noopener"
>official website&lt;/a>. At the time of writing, the latest version is Proxmox VE 9.0. Use whatever method you prefer to install Proxmox VE, such as using a USB drive.&lt;/p>
&lt;p>I will use IPMI of the server to install Proxmox VE, as it is the most convenient method for me. You can also use a monitor and keyboard to install Proxmox VE if you prefer.&lt;/p>
&lt;p>Mount the Proxmox VE installation ISO as virtual media so we can boot into.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188.png"
width="2560"
height="1600"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_fc3819d67899781d.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_9d957dfbafccb232.jpg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_f638cbe753e8df54.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_96242ea226abd1df.jpg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_bb01bd1f795bfa17.webp 1536w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_a80d7d3f160c23f3.jpg 1536w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_2406379d72ef1f1b.webp 2048w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_d73dbdf56d3ff481.jpg 2048w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_6f21ae6ec6e3868b.webp 2560w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250816213214188_hu_7b94c32487992fd7.jpg 2560w"
loading="lazy"
alt="image-20250816213214188"
class="gallery-image"
data-flex-grow="160"
data-flex-basis="384px"
>
&lt;/p>
&lt;p>Now reboot the server into the virtual media. Supermicro motherboards lets you invode the boot menu using F11. Your motherboard may have a different shortcut.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm1.jpeg"
width="1024"
height="768"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm1_hu_8ba3cfc0a697fe04.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm1_hu_9c46554a70e3f68b.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm1_hu_c7fc7a1ae7b4113d.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm1_hu_1b4cb758cf2fff8a.jpeg 1024w"
loading="lazy"
alt="kvm1"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;p>Choose our CDROM virtual media.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm2.jpeg"
width="800"
height="600"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm2_hu_9017089d67a44bb4.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm2_hu_e0cae96a987e1778.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm2_hu_209d9180b54cd190.webp 800w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm2_hu_bb993296d9dc2ad2.jpeg 800w"
loading="lazy"
alt="kvm2"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;p>Boot into the Proxmox install menu (I prefer terminal UI over GUI ones).&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm5.jpeg"
width="1024"
height="768"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm5_hu_bf96deb29f237104.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm5_hu_fbc78cf467a77c00.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm5_hu_9225fe3a3bdcfe99.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm5_hu_d4626b04625ebb28.jpeg 1024w"
loading="lazy"
alt="kvm5"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;p>After you accepted the license, you will need to choose the target installtion disk. You should choose the boot SSDs on your server, not data drives. The drive in picture is 3*1.92TB SSDs in RAID 5.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6.jpeg"
width="1280"
height="1024"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_dbb426d48c671cc8.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_6064335627e5139e.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_7f1d8d51d68f2aa4.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_208bd54bae9f396f.jpeg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_736c681430510399.webp 1280w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm6_hu_e7bd64cc7009b50f.jpeg 1280w"
loading="lazy"
alt="kvm6"
class="gallery-image"
data-flex-grow="125"
data-flex-basis="300px"
>
&lt;/p>
&lt;p>Toggle &lt;code>Advanced options&lt;/code>. Keep ext4, we will not be using ZFS. I know ZFS has CoW, snapshotting, compressing, checksums, and a ton of other features. But we will not use ZFS, because it will potentially cause some problems, e.g., high IO load when using RAID-Z zvols, extremely slow container start times when using ZFS storage driver in Docker, SSD write amplifications, low SSD random read/write performance, ZFS ARC not being given back to the OS as fast as needed on high memory pressure systems leading to OOM, and a ton of other issues that I previously encountered. To save me some trouble, I will use the battle-tested ext4.&lt;/p>
&lt;ul>
&lt;li>Total size: keep as-is&lt;/li>
&lt;li>Swap size: 0, we don&amp;rsquo;t need it, our memory is large enought (1TiB) and we will later use ZRAM as swap&lt;/li>
&lt;li>Maximum root volume size: 100 (GiB), make it slightly larger so we can install things into the root volume, but not too large to occupy the data volume space.&lt;/li>
&lt;/ul>
&lt;p>Other options can be left empty.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7.jpeg"
width="1280"
height="1024"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_2ff35877d03636be.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_378d3db78e6dd1f1.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_dc35289a6d315b63.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_5a57bbb82297cfbc.jpeg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_3de3e3022862cd88.webp 1280w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm7_hu_9f57d55dfbd59de8.jpeg 1280w"
loading="lazy"
alt="kvm7"
class="gallery-image"
data-flex-grow="125"
data-flex-basis="300px"
>
&lt;/p>
&lt;p>Other install steps (Keyboard setup, root password) can proceed as you normally would do. Remember to set a complex root password.&lt;/p>
&lt;p>Regarding to IP addresses:&lt;/p>
&lt;ul>
&lt;li>
&lt;p>If you are going to use a static IP address like I do, you can just set it here and forget about it.&lt;/p>
&lt;/li>
&lt;li>
&lt;p>If you are going to use a dynamic (DHCP) addresses, you should keep what&amp;rsquo;s already in here (static IP). You don&amp;rsquo;t need to change anything. The valid IP address should already be automatically discovered from DHCP servers and filled in. After the installation, you can change the static IP mode to DHCP mode by running &lt;code>vi /etc/network/interfaces&lt;/code> and make the following edits:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-diff" data-lang="diff">&lt;span class="line">&lt;span class="cl"> auto vmbr0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">- iface vmbr0 inet static
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">&lt;/span>&lt;span class="gi">+ iface vmbr0 inet dhcp # Enable DHCP and remove static IP.
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gi">&lt;/span>&lt;span class="gd">- address 10.112.154.220/16
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">- gateway 10.112.0.1
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="gd">&lt;/span> bridge-ports eno1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> bridge-stp off
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> bridge-fd 0
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>After you enabled DHCP in the config, apply it by &lt;code>ifreload -a&lt;/code>. Check if it takes effect by &lt;code>ip a show vmbr0&lt;/code>, you should see something like &lt;code>valid_lft 7160sec preferred_lft 7160sec&lt;/code>. If there is no &lt;code>xx sec&lt;/code> inside it, your DHCP is malfunctioning.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-console" data-lang="console">&lt;span class="line">&lt;span class="cl">&lt;span class="go">root@z8:/etc/network# ip a show vmbr0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go">4: vmbr0: &amp;lt;BROADCAST,MULTICAST,UP,LOWER_UP&amp;gt; mtu 1500 qdisc noqueue state UP group default qlen 1000
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go"> link/ether 30:13:8b:6d:3a:a6 brd ff:ff:ff:ff:ff:ff
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go"> inet 10.112.154.220/16 brd 10.112.255.255 scope global dynamic vmbr0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go"> valid_lft 7160sec preferred_lft 7160sec
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go"> inet6 fe80::3213:8bff:fe6d:3aa6/64 scope link
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="go"> valid_lft forever preferred_lft forever
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8.jpeg"
width="1280"
height="1024"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_f1e09d0126385e40.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_cf2d14b24937eaa4.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_f8717c460e0c3fb.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_c48c549747fce87b.jpeg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_bf0bf072e6823127.webp 1280w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm8_hu_52691de358776305.jpeg 1280w"
loading="lazy"
alt="kvm8"
class="gallery-image"
data-flex-grow="125"
data-flex-basis="300px"
>
&lt;/p>
&lt;h2 id="proxmox-ve-post-installtion">Proxmox VE Post-Installtion
&lt;/h2>&lt;p>Log in as root as we will make a few modifications.&lt;/p>
&lt;h3 id="change-apt-sources">Change APT Sources
&lt;/h3>&lt;p>In China, we don&amp;rsquo;t really have a good global Internet connection, so we will change APT source to mirrors in China.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Change APT source mirrors&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/deb.debian.org/mirrors.ustc.edu.cn/g&amp;#39;&lt;/span> /etc/apt/sources.list.d/debian.sources
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/security.debian.org/mirrors.ustc.edu.cn/g&amp;#39;&lt;/span> /etc/apt/sources.list.d/debian.sources
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Change Ceph source mirrors&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">if&lt;/span> &lt;span class="o">[&lt;/span> -f /etc/apt/sources.list.d/ceph.sources &lt;span class="o">]&lt;/span>&lt;span class="p">;&lt;/span> &lt;span class="k">then&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nv">CEPH_CODENAME&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="sb">`&lt;/span>ceph -v &lt;span class="p">|&lt;/span> grep ceph &lt;span class="p">|&lt;/span> awk &lt;span class="s1">&amp;#39;{print $(NF-1)}&amp;#39;&lt;/span>&lt;span class="sb">`&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nb">source&lt;/span> /etc/os-release
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> cat &amp;gt; /etc/apt/sources.list.d/ceph.sources &lt;span class="s">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Types: deb
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">URIs: https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Suites: $VERSION_CODENAME
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Components: no-subscription
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="k">fi&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Remove enterprise repo and add no-subscription repo.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Remove enterprise sources&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm /etc/apt/sources.list.d/pve-enterprise.sources
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Add no-subscription sources&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat &amp;gt; /etc/apt/sources.list.d/pve-no-subscription.sources &lt;span class="s">&amp;lt;&amp;lt;EOF
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Types: deb
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Suites: trixie
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Components: pve-no-subscription
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="change-ct-template-sources">Change CT Template Sources
&lt;/h3>&lt;p>Use mirrors in China.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sed -i.bak &lt;span class="s1">&amp;#39;s|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g&amp;#39;&lt;/span> /usr/share/perl5/PVE/APLInfo.pm
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl restart pvedaemon
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="stop-cluster-services">Stop Cluster Services
&lt;/h3>&lt;p>We are not using PVE clusters. Disable them. If you are using PVE clusters, you probably will not be reading this guide :P&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">systemctl disable --now pve-ha-crm.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl disable --now pve-ha-lrm.service
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl disable --now corosync.service
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="install-common-tools">Install Common Tools
&lt;/h3>&lt;p>Useful tools that will be used regularly.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">apt install htop sysstat vim sudo
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="configure-shell">Configure Shell
&lt;/h3>&lt;p>I like ZSH and my dotfiles, so I will use them.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">apt install git zsh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git clone --depth&lt;span class="o">=&lt;/span>&lt;span class="m">1&lt;/span> https://github.com/charlie0129/dotfiles.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> dotfiles
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">./bootstrap.sh -f
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chsh -s /usr/bin/zsh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Run zsh and follow the instructions&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">zsh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="configure-zram-swap">Configure ZRAM Swap
&lt;/h3>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone --depth&lt;span class="o">=&lt;/span>&lt;span class="m">1&lt;/span> https://github.com/foundObjects/zram-swap.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> zram-swap
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">./install.sh
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm -rf zram-swap
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>The default lz4 is a good balance between speed and compression ratio. If you want to sacrifice speed for better compression, you can change the config to use zstd as the compression method.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/_zram_algorithm=.*/_zram_algorithm=&amp;#34;zstd&amp;#34;/g&amp;#39;&lt;/span> /etc/default/zram-swap
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Apply&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">systemctl restart zram-swap
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Tune kernel parameters to make better use of ZRAM&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cat &lt;span class="s">&amp;lt;&amp;lt;EOF &amp;gt; /etc/sysctl.d/zram.conf
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">vm.swappiness = 180
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">vm.watermark_boost_factor = 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">vm.watermark_scale_factor = 125
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">vm.page-cluster = 0
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Apply&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sysctl --system
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="enable-ipv6-slaac">Enable IPv6 SLAAC
&lt;/h3>&lt;p>Proxmox disables IPv6 by default. To enable IPv6 SLAAC:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">cat &lt;span class="s">&amp;lt;&amp;lt;EOF &amp;gt; /etc/sysctl.d/ipv6.conf
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.default.accept_ra = 2
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.all.accept_ra = 2
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.default.forwarding = 1
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.all.forwarding = 1
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.default.proxy_ndp = 1
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">net.ipv6.conf.all.proxy_ndp = 1
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Apply it&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sysctl --system
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Note: the following command may break your internet connection.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl restart networking
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="trim-optimizations">TRIM Optimizations
&lt;/h3>&lt;p>TRIM will help prolong SSD lifespan and maintain performance. Enable it on the LVM thin pool.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/.*issue_discards = .*/\tissue_discards = 1/g&amp;#39;&lt;/span> /etc/lvm/lvm.conf
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Since LXCs are just on the host, it will automatically issue discards if the underlying storage supports it, so no further action is needed. If you are using VM, be sure to use SCSI disks (VirtIO SCSI Single) with &lt;code>discard=on&lt;/code> option. I&amp;rsquo;ve heard that VirtIO Block devices will not work with dicards but I haven&amp;rsquo;t tested it yet. Correct me if I&amp;rsquo;m wrong.&lt;/p>
&lt;h3 id="limit-journal-size">Limit Journal Size
&lt;/h3>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/.*SystemMaxUse.*/SystemMaxUse=32M/g&amp;#39;&lt;/span> /etc/systemd/journald.conf
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Apply&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">systemctl daemon-reload
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">systemctl restart systemd-journald
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h2 id="nvidia-p2p-driver-installation">NVIDIA P2P Driver Installation
&lt;/h2>&lt;p>Instead of regular NVIDIA drivers, we will be installing P2P-enabled drivers to force enable PCIe P2P capabilities on consumer cards (like GeForce RTX 4090). This will bring performance boost (~10%) across multiple scenarios. For details, refer to my blog post: &lt;a class="link" href="https://charlie0129.github.io/blog/p/rtx4090-p2p-unlocked/" >Enabling PCIe P2P on NVIDIA RTX 4090s&lt;/a>&lt;/p>
&lt;h3 id="disable-iommu">Disable IOMMU
&lt;/h3>&lt;p>Since PCIe P2P in Linux doesn&amp;rsquo;t work so well with IOMMU-enabled systems (there are many potential issues you may run into), you may as well just disable IOMMU. Note that if you have more than 255 CPU cores, you will only have access to 255 CPUs due to APIC fallback.&lt;/p>
&lt;p>To do disable IOMMU, you can either&lt;/p>
&lt;ul>
&lt;li>Disable Intel VT-d (AMD is on by default) in BIOS&lt;/li>
&lt;li>Disable &lt;code>intel_iommu&lt;/code> or &lt;code>amd_iommu&lt;/code> in Linux kernel parameters&lt;/li>
&lt;/ul>
&lt;p>To disable &lt;code>intel_iommu&lt;/code> or &lt;code>amd_iommu&lt;/code> in Linux kernel parameters, use the following command to add &lt;code>intel_iommu=off&lt;/code> and &lt;code>amd_iommu=off&lt;/code> to your &lt;code>GRUB_CMDLINE_LINUX_DEFAULT&lt;/code>. BTW: I also reduce the screen resolution to 1024x768 because it&amp;rsquo;s a server&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=&amp;#34;intel_iommu=off amd_iommu=off video=1024x768@60&amp;#34;/g&amp;#39;&lt;/span> /etc/default/grub
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Reboot your system to see the effect.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">reboot
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Make sure the follow command produces NO entries. If there are output, it means IOMMU is not correctly disabled.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">ls /sys/class/iommu
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="disable-acs">Disable ACS
&lt;/h3>&lt;p>You may need to disable ACS to get PCIe P2P to work, refer to &lt;a class="link" href="https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting.html" target="_blank" rel="noopener"
>https://docs.nvidia.com/deeplearning/nccl/user-guide/docs/troubleshooting.html&lt;/a> (PCI Access Control Services)&lt;/p>
&lt;h3 id="enable-above-4g-decoding">Enable Above 4G Decoding
&lt;/h3>&lt;p>PCIe P2P will need to access each GPU&amp;rsquo;s memory, so the PCIe BAR should be large enough to cover GPU&amp;rsquo;s memory. You must enable &lt;code>Above 4G Decoding&lt;/code> in your motherboard settings to make the PCIe BAR large enough to work. Enable it in your motherboard&amp;rsquo;s BIOS.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm3.jpeg"
width="800"
height="600"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm3_hu_7e15f21db3b3c17e.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm3_hu_9e3424f688b5b212.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm3_hu_c195e513c0a13d42.webp 800w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm3_hu_7d51eb80b8d4fadf.jpeg 800w"
loading="lazy"
alt="kvm3"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;h3 id="install-official-driver">Install Official Driver
&lt;/h3>&lt;p>Before we install the P2P kernel module, we need to install the official drivers.&lt;/p>
&lt;p>Since we are installing unofficial P2P kernel modules, there is a limited number of driver version that will work. The version of the P2P kernel modules MUST be the same as the official driver we are going to install.&lt;/p>
&lt;p>Refer to &lt;a class="link" href="https://github.com/tinygrad/open-gpu-kernel-modules" target="_blank" rel="noopener"
>https://github.com/tinygrad/open-gpu-kernel-modules&lt;/a> to see what versions are available. I also have my patches that works with much newer driver versions (&lt;code>575.57.08&lt;/code>) (at the time of writing) &lt;a class="link" href="https://github.com/charlie0129/open-gpu-kernel-modules" target="_blank" rel="noopener"
>https://github.com/charlie0129/open-gpu-kernel-modules&lt;/a> .&lt;/p>
&lt;p>I will be using version &lt;code>575.57.08&lt;/code>, so we should download the official driver of the same version (575.57.08). You should download the &lt;code>.run&lt;/code> file, e.g., &lt;code>NVIDIA-Linux-x86_64-575.57.08.run&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Assume you download the installer as NVIDIA-Linux-x86_64-575.57.08.run&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">installer&lt;/span>&lt;span class="o">=&lt;/span>&lt;span class="s2">&amp;#34;NVIDIA-Linux-x86_64-575.57.08.run&amp;#34;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chmod +x &lt;span class="nv">$installer&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Skip kernel modules because we will install P2P-patched version later.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">./&lt;span class="nv">$installer&lt;/span> --no-kernel-modules
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Choose whatever you want, doesn&amp;rsquo;t matter.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967.png"
width="1332"
height="936"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_98208fee79b653b6.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_8c48fb6ddb80aa09.jpg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_961f2daf7702c60.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_c210bf19507e4f39.jpg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_b2550ba7a4857e9c.webp 1332w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000515967_hu_e39d158f30e89b6a.jpg 1332w"
loading="lazy"
alt="image-20250817000515967"
class="gallery-image"
data-flex-grow="142"
data-flex-basis="341px"
>
&lt;/p>
&lt;p>Yes, disable nouveau, we will be using NVIDIA drivers.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521.png"
width="1332"
height="936"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_c04467322fc6b9b5.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_6960c0b2e9c6b7b7.jpg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_3b938860c46b37b2.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_166683d5e7642037.jpg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_6cffe724c88436b4.webp 1332w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000549521_hu_74c62616de8a0c23.jpg 1332w"
loading="lazy"
alt="image-20250817000549521"
class="gallery-image"
data-flex-grow="142"
data-flex-basis="341px"
>
&lt;/p>
&lt;p>Do not abort, just continue. Nouveau will be disabled on next boot.&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879.png"
width="1332"
height="936"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_d23455096df2bfa2.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_6b7514f546ecd5da.jpg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_849962d25bf10f61.webp 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_d5e6cd44b8bf36e5.jpg 1024w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_7936dd81616107f0.webp 1332w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/image-20250817000652879_hu_a5cd53c580d81314.jpg 1332w"
loading="lazy"
alt="image-20250817000652879"
class="gallery-image"
data-flex-grow="142"
data-flex-basis="341px"
>
&lt;/p>
&lt;p>Just choose the default option for every step that comes later.&lt;/p>
&lt;p>Remove the driver installation file because we will not be using it later.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">rm &lt;span class="nv">$installer&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You can skip reboot now. We will reboot after we installed the kernel modules.&lt;/p>
&lt;h3 id="install-p2p-enabled-kernel-modules">Install P2P-Enabled Kernel Modules
&lt;/h3>&lt;p>Make sure the version of the P2P-enabled kernel modules match the version of the driver. I will use veriosn 575.57.08.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone --depth&lt;span class="o">=&lt;/span>&lt;span class="m">1&lt;/span> -b 575.57.08-p2p https://github.com/charlie0129/open-gpu-kernel-modules.git
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>To build kernel modules, install build dependencies and kernel source. &lt;code>sudo&lt;/code> installed because the install script uses &lt;code>sudo&lt;/code> but we don&amp;rsquo;t have it now.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">apt install sudo build-essential proxmox-headers-&lt;span class="k">$(&lt;/span>uname -r&lt;span class="k">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Build and install the kernel module&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">./install.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You can safely ignore the NVIDIA-SMI failure as long as the build succeeds (you should see a &lt;code>DEPMOD /lib/modules/6.14.8-2-pve&lt;/code> line) because we haven&amp;rsquo;t rebooted yet (so NVIDIA-SMI can&amp;rsquo;t be used).&lt;/p>
&lt;p>Remove the source after installing&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> ..
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm -rf open-gpu-kernel-modules
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Reboot your system and you should see &lt;code>nvidia-smi&lt;/code> running fine.&lt;/p>
&lt;p>To tell if P2P is enabled, we will use a simple method (performance testing will be done later):&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">nvidia-smi -q &lt;span class="p">|&lt;/span> grep -i bar -A &lt;span class="m">3&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You should see &lt;code>&amp;gt; 2048 MiB&lt;/code> BAR1 Total memory, &lt;code>32768 MiB&lt;/code> in my case.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl"> BAR1 Memory Usage
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Total : 32768 MiB
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Used : 2 MiB
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Free : 32766 MiB
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="enable-persistence-mode">Enable Persistence Mode
&lt;/h3>&lt;p>Persistence mode will:&lt;/p>
&lt;ul>
&lt;li>Keep the GPU driver running so program can start faster&lt;/li>
&lt;li>Lower GPU power mode when it&amp;rsquo;s idle to save power. For RTX 4090s, it can drop from ~70W to ~10W.&lt;/li>
&lt;li>Make sure &lt;code>/dev/nvidia*&lt;/code> device nodes are ready. This is useful because we are passing the GPU devices &lt;code>/dev/nvidia*&lt;/code> to CTs (LXC Containers) later, it requires the device nodes to be present on start up for auto-started CTs.&lt;/li>
&lt;/ul>
&lt;p>So you really should enable it.&lt;/p>
&lt;p>To enable persistence mode:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">/usr/bin/nvidia-smi -pm &lt;span class="m">1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>To make it persistent across reboots, we will use a cron job.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">crontab -e
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Add a line to run &lt;code>nvidia-smi&lt;/code> on boot:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">@reboot /usr/bin/nvidia-smi -pm &lt;span class="m">1&lt;/span> &amp;gt;/dev/null 2&amp;gt;&lt;span class="p">&amp;amp;&lt;/span>&lt;span class="m">1&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;blockquote>
&lt;p>Why not use &lt;code>nvidia-persistenced&lt;/code> systemd service? Because for whatever reason, it does not initialize the device nodes &lt;code>/dev/nvidia*&lt;/code> correctly, so auto-started CTs will encounter &lt;code>Cuda failure 'unknown error'&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> /usr/share/doc/NVIDIA_GLX-1.0/samples
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tar jxf nvidia-persistenced-init.tar.bz2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> nvidia-persistenced-init
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">./install.sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;/blockquote>
&lt;p>You should feel &lt;code>nvidia-smi&lt;/code> runs much faster than before.&lt;/p>
&lt;h2 id="build-ct-templates">Build CT Templates
&lt;/h2>&lt;p>We will build a CT Template that has everything a student will need:&lt;/p>
&lt;ul>
&lt;li>Common build dependencies&lt;/li>
&lt;li>CUDA&lt;/li>
&lt;li>Docker&lt;/li>
&lt;li>&amp;hellip;&lt;/li>
&lt;/ul>
&lt;p>Download the Linux distro you want. I chose Ubuntu 24.04, not because I like Ubuntu (I use Debian), but because most students only know Ubuntu.&lt;/p>
&lt;p>Create an unprivileged CT just like you normally would. Just remember to give it a bit more disk space (32GB or more) because we will install CUDA later and CUDA is really large.&lt;/p>
&lt;h3 id="install-docker">Install Docker
&lt;/h3>&lt;p>After you created the CT, shut it down. Add additional settings to allow Docker to use overlayfs driver, otherwise Docker images will be extremely inefficient in CTs.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This command should be run on the host, not CT.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Assume 8000 is the ID of your template CT&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat &lt;span class="s">&amp;lt;&amp;lt;EOF &amp;gt;&amp;gt; /etc/pve/local/lxc/8000.conf
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.apparmor.profile: unconfined
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.cgroup.devices.allow: a
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.cap.drop:
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>All following commands should be run in the CT unless specified otherwise.&lt;/p>
&lt;p>Add Docker configuration. Systemd journal is used as log driver to make use of previously configured journal size limit. By writing logs to a centralized location, it&amp;rsquo;s also useful if you want to write logs to memory to reduce disk writes (e.g. log2ram).&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">mkdir -p /etc/docker/
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat &lt;span class="s">&amp;lt;&amp;lt;EOF &amp;gt; /etc/docker/daemon.json
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">{
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> &amp;#34;live-restore&amp;#34;: true,
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> &amp;#34;experimental&amp;#34;: true,
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s"> &amp;#34;log-driver&amp;#34;: &amp;#34;journald&amp;#34;
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">}
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Install Docker&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">export&lt;/span> &lt;span class="nv">DOWNLOAD_URL&lt;/span>&lt;span class="o">=&lt;/span>https://mirrors.ustc.edu.cn/docker-ce
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">curl -fsSL https://get.docker.io &lt;span class="p">|&lt;/span> sh
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="revert-containerd-config">Revert Containerd Config
&lt;/h3>&lt;p>Docker modified containerd config. We will revert it to the default config.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">containerd config default &amp;gt;/etc/containerd/config.toml
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="add-gpus-to-ct">Add GPUs to CT
&lt;/h3>&lt;p>Choose which GPU you need to passthrough by looking for the index in &lt;code>nvidia-smi&lt;/code>, or by &lt;code>ls -l /dev/nvidia*&lt;/code>&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This command should be run on the host, not CT.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ls -l /dev/nvidia*&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">0&lt;/span> 2025-08-17 01:47:58 /dev/nvidia0
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">1&lt;/span> 2025-08-17 01:48:00 /dev/nvidia1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">2&lt;/span> 2025-08-17 01:48:01 /dev/nvidia2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">3&lt;/span> 2025-08-17 01:48:02 /dev/nvidia3
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">4&lt;/span> 2025-08-17 01:48:03 /dev/nvidia4
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">5&lt;/span> 2025-08-17 01:48:05 /dev/nvidia5
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">6&lt;/span> 2025-08-17 01:48:06 /dev/nvidia6
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">crw-rw-rw- &lt;span class="m">1&lt;/span> root root 195, &lt;span class="m">7&lt;/span> 2025-08-17 01:48:07 /dev/nvidia7
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">... &lt;span class="o">(&lt;/span>omitted&lt;span class="o">)&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>For example, if want to add all 8 GPUs (0, 1, 2, 3, 4, 5, 6, 7) to CT, I will need to run:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># This command should be run on the host, not CT.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Assume 8000 is the ID of your template CT&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cat &lt;span class="s">&amp;lt;&amp;lt;EOF &amp;gt;&amp;gt; /etc/pve/local/lxc/8000.conf
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia1 dev/nvidia1 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia2 dev/nvidia2 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia3 dev/nvidia3 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia4 dev/nvidia4 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia5 dev/nvidia5 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia6 dev/nvidia6 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia7 dev/nvidia7 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">lxc.mount.entry: /dev/fb0 dev/fb0 none bind,optional,create=file
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="s">EOF&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Note the &lt;code>lxc.mount.entry: /dev/nvidiaX dev/nvidiaX none bind,optional,create=file&lt;/code> lines. Each line represents a single GPU to add to the CT. I will add 8 GPUs, so I add 8 lines from &lt;code>nvidia0&lt;/code> through &lt;code>nvidia7&lt;/code>. Remove or add them as needed.&lt;/p>
&lt;p>Check if the GPUs are there inside CT:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-gdscript3" data-lang="gdscript3">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># ls -l /dev/nvidia*&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">00&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">modeset&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">50&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">43&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">uvm&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">50&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">43&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">uvm&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">tools&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">47&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">58&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia0&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">00&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia1&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">01&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia2&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">02&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia3&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">03&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia4&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">05&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia5&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">06&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia6&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">48&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">07&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidia7&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">crw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="n">rw&lt;/span>&lt;span class="o">-&lt;/span> &lt;span class="n">nobody&lt;/span> &lt;span class="n">nogroup&lt;/span> &lt;span class="mi">0&lt;/span> &lt;span class="n">B&lt;/span> &lt;span class="mi">2025&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">08&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">17&lt;/span> &lt;span class="mi">01&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">47&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">58&lt;/span> &lt;span class="o">/&lt;/span>&lt;span class="n">dev&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">nvidiactl&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>We haven&amp;rsquo;t installed drivers yet, so nvidia-smi is not available.&lt;/p>
&lt;h3 id="install-gpu-driver">Install GPU Driver
&lt;/h3>&lt;p>Important: you should use the same driver version as the host (&lt;code>575.57.08&lt;/code> in my case).&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget &amp;lt;driver-runfile-url&amp;gt; -O driver.run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chmod +x driver.run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">driver.run --no-kernel-modules
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm driver.run
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Just install as normal.&lt;/p>
&lt;p>Now you should be able to use &lt;code>nvidia-smi&lt;/code> and see the GPUs you added to the CT (8 GPUs in my case).&lt;/p>
&lt;h3 id="install-cuda">Install CUDA
&lt;/h3>&lt;p>Important: current driver version MUST be greater than (or equal to) the driver required by CUDA. For example, CUDA 12.9.0 will work on my machine because CUDA 12.9.0 requires &lt;code>575.00&lt;/code>, and my current driver version is &lt;code>575.57.08&lt;/code> (greater than &lt;code>575.00&lt;/code>).&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">wget &amp;lt;cuda-runfile-url&amp;gt; -O cuda.run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">chmod +x cuda.run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cuda.run
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm cuda.run
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Remember to deselect the driver (we already installed the correct driver):&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">┌──────────────────────────────────────────────────────────────────────────────┐
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ CUDA Installer │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ - [ ] Driver &amp;lt;== deselect this │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ [ ] 575.51.03 &amp;lt;== deselect this │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ + [X] CUDA Toolkit 12.9 │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ [ ] CUDA Demo Suite 12.9 &amp;lt;== deselect this (not useful, takes up space) │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ [ ] CUDA Documentation 12.9 &amp;lt;== deselect this (not useful, takes up space) │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ - [ ] Kernel Objects │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ [ ] nvidia-fs │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ Options │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ Install │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">│ Up/Down: Move | Left/Right: Expand | &amp;#39;Enter&amp;#39;: Select | &amp;#39;A&amp;#39;: Advanced options │
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">└──────────────────────────────────────────────────────────────────────────────┘
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>After CUDA installation, configure &lt;code>PATH&lt;/code> and &lt;code>LD_LIBRARY_PATH&lt;/code> per printed instructions.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">... (omitted)
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Please make sure that
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> - PATH includes /usr/local/cuda-12.9/bin
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> - LD_LIBRARY_PATH includes /usr/local/cuda-12.9/lib64, or, add /usr/local/cuda-12.9/lib64 to /etc/ld.so.conf and run ldconfig as root
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">... (omitted)
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Note that you can use &lt;code>/usr/local/cuda&lt;/code> instead of &lt;code>/usr/local/cuda-XX.X&lt;/code> so it&amp;rsquo;s independent of CUDA versions.&lt;/p>
&lt;p>Also add &lt;code>export CUDA_HOME=/usr/local/cuda&lt;/code> to your shell rc file.&lt;/p>
&lt;p>nvcc should be available after a shell reload:&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-gdscript3" data-lang="gdscript3">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># nvcc -V&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">nvcc&lt;/span>&lt;span class="p">:&lt;/span> &lt;span class="n">NVIDIA&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="n">R&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="n">Cuda&lt;/span> &lt;span class="n">compiler&lt;/span> &lt;span class="n">driver&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Copyright&lt;/span> &lt;span class="p">(&lt;/span>&lt;span class="n">c&lt;/span>&lt;span class="p">)&lt;/span> &lt;span class="mi">2005&lt;/span>&lt;span class="o">-&lt;/span>&lt;span class="mi">2025&lt;/span> &lt;span class="n">NVIDIA&lt;/span> &lt;span class="n">Corporation&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Built&lt;/span> &lt;span class="n">on&lt;/span> &lt;span class="n">Wed_Apr__9_19&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">24&lt;/span>&lt;span class="p">:&lt;/span>&lt;span class="mi">57&lt;/span>&lt;span class="n">_PDT_2025&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Cuda&lt;/span> &lt;span class="n">compilation&lt;/span> &lt;span class="n">tools&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">release&lt;/span> &lt;span class="mf">12.9&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="n">V12&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="mf">9.41&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="n">Build&lt;/span> &lt;span class="n">cuda_12&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="mf">9.&lt;/span>&lt;span class="n">r12&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="mi">9&lt;/span>&lt;span class="o">/&lt;/span>&lt;span class="n">compiler&lt;/span>&lt;span class="o">.&lt;/span>&lt;span class="mi">35813241&lt;/span>&lt;span class="n">_0&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="install-nccl">Install NCCL
&lt;/h3>&lt;p>You will need NCCL for most GPU-related communications.&lt;/p>
&lt;p>You should find a NCCL that&amp;rsquo;s compatible with your CUDA version. For example, NCCL &lt;code>2.27.3&lt;/code> is compatible with my CUDA version &lt;code>12.9&lt;/code>.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;span class="lnt">16
&lt;/span>&lt;span class="lnt">17
&lt;/span>&lt;span class="lnt">18
&lt;/span>&lt;span class="lnt">19
&lt;/span>&lt;span class="lnt">20
&lt;/span>&lt;span class="lnt">21
&lt;/span>&lt;span class="lnt">22
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Download NCCL package&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">wget https://xxx/nccl_2.27.3-1+cuda12.9_x86_64.txz
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">tar Jxf nccl_2.27.3-1+cuda12.9_x86_64.txz
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Set some variables&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nv">NCCL_VERSION&lt;/span>&lt;span class="o">=&lt;/span>2.27
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">mkdir -p /usr/local/nccl-&lt;span class="nv">$NCCL_VERSION&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">cp -vRf nccl_2.27.3-1+cuda12.9_x86_64/* /usr/local/nccl-&lt;span class="nv">$NCCL_VERSION&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm -rf nccl_2.27.3-1+cuda12.9_x86_64
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ln -s /usr/local/nccl-&lt;span class="nv">$NCCL_VERSION&lt;/span> /usr/local/nccl
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> &lt;span class="s2">&amp;#34;/usr/local/nccl/lib&amp;#34;&lt;/span> &amp;gt;&amp;gt;/etc/ld.so.conf
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ldconfig
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ln -s /usr/local/nccl/include/nccl.h /usr/local/include/nccl.h
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="c1"># Remove NCCL package&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm https://xxx/nccl_2.27.3-1+cuda12.9_x86_64.txz
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Also add &lt;code>export NCCL_HOME=/usr/local/nccl&lt;/code> in your shell rc file,&lt;/p>
&lt;h3 id="install-nvidia-container-toolkit">Install NVIDIA Container Toolkit
&lt;/h3>&lt;p>To run Docker containers with GPUs.&lt;/p>
&lt;p>Note that the URLs below are mirrors in China. You can use original URL if you prefer.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;span class="lnt">6
&lt;/span>&lt;span class="lnt">7
&lt;/span>&lt;span class="lnt">8
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">curl -fsSL https://mirrors.ustc.edu.cn/libnvidia-container/gpgkey &lt;span class="p">|&lt;/span> sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">curl -s -L https://mirrors.ustc.edu.cn/libnvidia-container/stable/deb/nvidia-container-toolkit.list &lt;span class="p">|&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> sed &lt;span class="s1">&amp;#39;s#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g&amp;#39;&lt;/span> &lt;span class="p">|&lt;/span> &lt;span class="se">\
&lt;/span>&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="se">&lt;/span> tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">sed -i &lt;span class="s1">&amp;#39;s/nvidia.github.io/mirrors.ustc.edu.cn/g&amp;#39;&lt;/span> /etc/apt/sources.list.d/nvidia-container-toolkit.list
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">apt-get update
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">apt-get install -y nvidia-container-toolkit
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Configure Docker and Containerd to use NVIDIA Container Toolkit&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">nvidia-ctk runtime configure --runtime&lt;span class="o">=&lt;/span>docker
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">nvidia-ctk runtime configure --runtime&lt;span class="o">=&lt;/span>containerd
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Since we are running inside unprivileged containers, we need to set &lt;code>no-cgroups&lt;/code> to true&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">nvidia-ctk config --set nvidia-container-cli.no-cgroups --in-place
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="install-nvidia-nsight-systems">Install NVIDIA Nsight Systems
&lt;/h3>&lt;p>So we can profile applications running on the GPU.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl">wget https://xxx/NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">dpkg -i NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm -f NsightSystems-linux-cli-public-2025.3.1.90-3582212.deb
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;h3 id="functionality-tests">Functionality Tests
&lt;/h3>&lt;h4 id="nccl">NCCL
&lt;/h4>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone https://github.com/NVIDIA/nccl-tests.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> nccl-tests
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git reset --hard 903918f &lt;span class="c1"># I only tested this commit.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">make
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>P2P ON: &lt;code>NCCL_P2P_LEVEL=sys ./build/all_reduce_perf --minbytes 8 --maxbytes 128M --stepfactor 2 --ngpus 8&lt;/code> (change &lt;code>--ngpus&lt;/code> accordingly)&lt;/p>
&lt;p>P2P OFF: &lt;code>NCCL_P2P_DISABLE=1 ./build/all_reduce_perf --minbytes 8 --maxbytes 128M --stepfactor 2 --ngpus 8&lt;/code> (change &lt;code>--ngpus&lt;/code> accordingly)&lt;/p>
&lt;p>You should see a bandwidth increase after P2P is on.&lt;/p>
&lt;h4 id="cuda-p2p">CUDA P2P
&lt;/h4>&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;span class="lnt">3
&lt;/span>&lt;span class="lnt">4
&lt;/span>&lt;span class="lnt">5
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">git clone https://github.com/NVIDIA/cuda-samples.git
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">git reset --hard 9c688d7 &lt;span class="c1"># I only tested this commit.&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span> cuda-samples/Samples/5_Domain_Specific/p2pBandwidthLatencyTest
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">make
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">./p2pBandwidthLatencyTest
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>You should see lower GPU-GPU latency, higher bandwidth if P2P is on.&lt;/p>
&lt;h3 id="prepare-for-templating">Prepare for Templating
&lt;/h3>&lt;p>Check if there are unnecessary files and remove them.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt">1
&lt;/span>&lt;span class="lnt">2
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">ls -l
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Remove history&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-bash" data-lang="bash">&lt;span class="line">&lt;span class="cl">&lt;span class="nb">cd&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">unset&lt;/span> HISTFILE
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm .*_history
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> -n &amp;gt;/var/log/lastlog
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> -n &amp;gt;/var/log/wtmp
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="nb">echo&lt;/span> -n &amp;gt;/var/log/btmp
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">journalctl --vacuum-time&lt;span class="o">=&lt;/span>1s
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">rm -f /var/log/*.log
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>Now, it&amp;rsquo;s ready for converting to a template. To give each student a new development container, just clone this template.&lt;/p>
&lt;h2 id="other-minor-settings">Other Minor Settings
&lt;/h2>&lt;h3 id="raid-card-write-back">RAID Card Write Back
&lt;/h3>&lt;p>To achieve maximum write speed, you can enable &lt;code>write back&lt;/code> mode on your RAID card, so data is written to cache first. This will significantly (yes, by A LOT, sometimes over 100x) improve random write speed on HDDs (SSDs are already very fast). If your RAID card has a battery, you don&amp;rsquo;t need to worry about data integrity in case a power failure.&lt;/p>
&lt;p>Write cache policy:&lt;/p>
&lt;ul>
&lt;li>&lt;code>Write Throuh&lt;/code>: no cache&lt;/li>
&lt;li>&lt;code>Write Back&lt;/code>: cached if battery backup is present on the RAID card&lt;/li>
&lt;li>&lt;code>Always Write Back&lt;/code>: always cached&lt;/li>
&lt;/ul>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm4.jpeg"
width="800"
height="600"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm4_hu_cf6cf63f2dd5b21c.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm4_hu_e57234e7f2dfb528.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm4_hu_8b6806be98b2182f.webp 800w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm4_hu_c76764e8bd8ebf46.jpeg 800w"
loading="lazy"
alt="kvm4"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;h2 id="obstacles">Obstacles
&lt;/h2>&lt;h3 id="only-255-cores-are-recognized---x2apic">Only 255 Cores are Recognized - x2APIC
&lt;/h3>&lt;p>I noticed that I have one CPU offline. It should recognize 256 CPUs but I only have 255 CPUs.&lt;/p>
&lt;div class="highlight">&lt;div class="chroma">
&lt;table class="lntable">&lt;tr>&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code>&lt;span class="lnt"> 1
&lt;/span>&lt;span class="lnt"> 2
&lt;/span>&lt;span class="lnt"> 3
&lt;/span>&lt;span class="lnt"> 4
&lt;/span>&lt;span class="lnt"> 5
&lt;/span>&lt;span class="lnt"> 6
&lt;/span>&lt;span class="lnt"> 7
&lt;/span>&lt;span class="lnt"> 8
&lt;/span>&lt;span class="lnt"> 9
&lt;/span>&lt;span class="lnt">10
&lt;/span>&lt;span class="lnt">11
&lt;/span>&lt;span class="lnt">12
&lt;/span>&lt;span class="lnt">13
&lt;/span>&lt;span class="lnt">14
&lt;/span>&lt;span class="lnt">15
&lt;/span>&lt;/code>&lt;/pre>&lt;/td>
&lt;td class="lntd">
&lt;pre tabindex="0" class="chroma">&lt;code class="language-fallback" data-lang="fallback">&lt;span class="line">&lt;span class="cl"># lscpu
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Architecture: x86_64
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> CPU op-mode(s): 32-bit, 64-bit
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Address sizes: 48 bits physical, 48 bits virtual
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Byte Order: Little Endian
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">CPU(s): 256
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> On-line CPU(s) list: 0-254
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Off-line CPU(s) list: 255 &amp;lt;--------------- one CPU is offline -----------
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">Vendor ID: AuthenticAMD
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Model name: AMD EPYC 7763 64-Core Processor
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> CPU family: 25
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Model: 1
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Thread(s) per core: 2
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Core(s) per socket: 64
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> Socket(s): 2
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/td>&lt;/tr>&lt;/table>
&lt;/div>
&lt;/div>&lt;p>After some digging, I learned that I need to enable &lt;code>x2APIC&lt;/code> on both the motherboard and kernel to have more than 255 CPU cores recognized.&lt;/p>
&lt;p>In BIOS &lt;code>Local APIC Mode&lt;/code> should already be &lt;code>x2APIC&lt;/code> .&lt;/p>
&lt;p>&lt;img src="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm9.jpeg"
width="800"
height="600"
srcset="https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm9_hu_2d8789994fa6a9a2.webp 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm9_hu_21d37ab5a4ab49.jpeg 480w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm9_hu_fe3ad68b7055c380.webp 800w, https://charlie0129.github.io/blog/p/proxmox-ve-shared-gpu-installation-guide/images/kvm9_hu_7ce9a82287fa5f2a.jpeg 800w"
loading="lazy"
alt="kvm9"
class="gallery-image"
data-flex-grow="133"
data-flex-basis="320px"
>
&lt;/p>
&lt;p>Now I realized it can be because I disabled IOMMU for PCIe P2P before. It turns out that disableing IOMMU can limit the number of available logical cores to 255. The reason is that the Linux kernel disables x2APIC in this case and falls back to APIC, which can only enumerate a maximum of 255 (logical) cores.&lt;/p>
&lt;p>I will keep IOMMU disabled because I need PCIe P2P to function (I don&amp;rsquo;t want to deal with P2P with IOMMU on). Just forget about the 256th core :p.&lt;/p></description></item></channel></rss>