VMAT Free for Linux

VMAT runs VMs that share this computer's GPU, with no passthrough and no
vGPU licence. VMAT Free runs four VMs at a time, each with up to 4 GB of
RAM and a text console, for as long as you like. The VMs share the GPU
either way: Shared lends an idle VM's GPU time to the busy ones, and Fixed
gives each of N VMs 1/N.

What it needs

Ubuntu 24.04 or later, Debian 13, Fedora 40 or later, or RHEL 10, on x86-64.
KVM, with your user in the kvm group:

    sudo usermod -aG kvm $USER

then log out and in. A GPU driver with Vulkan (the package pulls in the
Vulkan loader). For CUDA in the VMs, an NVIDIA GPU; see below.

RAM: two VMs of 2 GB want a computer with 16 GB, four of 2 GB want 32 GB,
and two of 4 GB, the most VMAT Free gives a VM, want 24 GB. Each VM's memory, and
1 GB more for its share of the GPU, is kept in /dev/shm, which Linux makes
half of the RAM. On a computer with 8 GB, one VM fits; for two VMs of 1 GB,
give /dev/shm more until the next restart:

    sudo mount -o remount,size=75% /dev/shm

Starting

Run vmat in a terminal, as yourself and not with sudo, or pick VMAT in the
applications menu. It opens VMAT's page in your browser (or in its own
window, where the system's WebKitGTK 6 is). On the page, press "+ Add a VM",
pick the guest, set its RAM and disk, and press "Make and start it".
VMAT Free makes Debian 13 and Ubuntu 26.04 LTS VMs from the .deb, and
Fedora 44 VMs from the .rpm; the other guests and your own disk images
are in VMAT Pro. Each is downloaded from its project the first time you
pick one (300 to 900 MB; from download.vmat.dev if that fails), checked
against the checksum VMAT carries, and kept for the next VM.

The VM's console opens in a tab and logs in as root by itself. Its first
boot installs VMAT's guest library, which takes a minute or two, and a
Debian VM restarts once. Then try

    vmattest

which checks the GPU's answers against the VM's own processor and times it.

"Quit VMAT" on the page, or Ctrl-C in the terminal, shuts the VMs down and
stops VMAT. The page answers only on this computer, and only with the key
in the address vmat opens. Your VMs and logs are in ~/.local/share/vmat.

CUDA programs in the VMs

With an NVIDIA GPU, CUDA programs in Linux VMs run on it. The VM needs
nothing of NVIDIA's: no driver, no passthrough. This computer needs:

NVIDIA's driver, for CUDA 12.4 or later.

NVIDIA's cuBLAS 12 where the loader finds it, for llama.cpp. It comes
from NVIDIA's CUDA repository for your system. PyTorch in a VM also needs
NVIDIA's cuDNN, cuSOLVER, cuFFT and cuSPARSE here, from the same place,
and nvJitLink, which cuSOLVER uses and its package may not bring.

HMM off. With NVIDIA's open kernel modules, GPU code could reach all the
memory of the process that runs it, so VMAT serves no CUDA until it is off:

    echo "options nvidia_uvm uvm_disable_hmm=1" | sudo tee /etc/modprobe.d/vmat-uvm.conf

then restart the computer.

llama.cpp in a VM has to be a build for CUDA 12 (we use b12030 with the
CUDA 12.8 toolkit).

PyTorch in a VM. What we tested is PyTorch 2.11.0 built for CUDA 12.8,
in a Debian 13 VM with 4 GB of RAM and a 40 GB disk (PyTorch with its
libraries is 7 GB). In the VM:

    apt install -y python3-venv
    python3 -m venv /root/v
    mkdir -p /root/tmp
    TMPDIR=/root/tmp /root/v/bin/pip install --no-cache-dir \
        torch==2.11.0 torchvision==0.26.0 \
        --index-url https://download.pytorch.org/whl/cu128
    vmat-cuda-link /root/v/bin/python
    /root/v/bin/python -c "import torch; print(torch.cuda.get_device_name(0))"

pip brings NVIDIA's libraries with PyTorch, which can't work in a VM;
vmat-cuda-link puts VMAT's in their place (run it again after pip
installs or upgrades PyTorch; -u undoes it). TMPDIR is there because
Debian 13's /tmp is too small for pip's download. The PyTorch pip gives
when no version is named is built for CUDA 13, and that one doesn't load
in a VM yet; vmat-cuda-link says so and leaves it alone.

In VMAT Free, CUDA is for four VMs at a time, and each VM's programs may
hold 16 GB of the GPU's memory. The VMs share what the GPU has: when one
VM holds most of it, the others' programs get less, as on any shared GPU.
VMAT Pro has no cap.

Removing it

sudo apt remove vmat, or sudo dnf remove vmat. Your VMs stay in
~/.local/share/vmat until you delete that folder.

Licences

VMAT's own programs are given to you under the VMAT Beta Tester Agreement
(BETA-AGREEMENT.txt); NOTICE lists the rest. The network helper carries
lwIP (LICENSE.lwip), the VMs' firmware is edk2 (LICENSE.edk2) with OpenSSL
(LICENSE.openssl), and the consoles on the page are xterm.js
(LICENSE.xterm). vmat loads OpenH264 from the system and doesn't carry it.

Please send all feedback to vmat.dev@gmail.com.
