Build under a virtual CPU with QEMU¶
A build that detects the CPU it runs on gets the host’s view, so a Zen 5 node builds for Zen 5 whatever target you want.
eb-local __vm-run runs a command inside QEMU with a CPU that presents the target instead, and checks that every detector agrees before the command starts.
It is an internal helper: the command reference lists its options and exit statuses, and the builds that mask the CPU view call it.
These steps run it by hand, to see what a target looks like or to debug a masked build.
Before you start¶
For --mode kvm, a target of the host’s architecture:
/dev/kvm, readable and writable by you.qemu-system-x86_64andvirtiofsdonPATH, or in a directory thatEB_LOCAL_QEMU_DIRnames, withEB_LOCAL_VIRTIOFSDfor avirtiofsdelsewhere. On a Nix host the directory is thebinof the QEMU store path.A host kernel that has virtiofs, virtio-pci and devtmpfs built in. The helper boots
/lib/modules/$(uname -r)/vmlinuz, then/boot/vmlinuz-$(uname -r);EB_LOCAL_VM_KERNELnames another image.bash,setprivandsttyfrom util-linux and coreutils on the host: the guest runs the host’s own root file system, read-only.A temporary directory on the root file system:
EB_LOCAL_VM_DIR,TMPDIR,/var/tmpor/tmp, the first that is.EESSI mounted at
/cvmfs/software.eessi.io.
For --mode tcg, a target of the other architecture:
qemu-aarch64(orqemu-x86_64on an aarch64 host), found as above.A kernel that lets you create user and mount namespaces, 6.7 or later, unless the host already has a
qemu-aarch64entry inbinfmt_misc. Without the entry, the helper registers the emulator in a namespace of its own, which needs no root.The EESSI compatibility layer of the target’s architecture under
/cvmfs/software.eessi.io.
EESSI_VERSION names the EESSI version both modes check; it defaults to 2026.06.
Run a command as a Zen 4¶
eb-local __vm-run --mode kvm --cpu-target x86_64/amd/zen4 -- \
bash -c 'gcc -march=native -Q --help=target | grep -- -march='
The guest boots in a few seconds, checks the CPU, and prints one line before the command output:
eb-local: vm-run: x86_64/amd/zen4 presented: vendor=AuthenticAMD archdetect=x86_64/amd/zen4 archspec=zen4 gcc=znver4
The compiler then names znver4 on a Zen 5 host.
The command runs in your working directory, as your user and group, and its exit status is the helper’s.
Files it creates there belong to you.
The guest mounts these writable: your working directory and the directories HOME, TMPDIR, EASYBUILD_PREFIX, EASYBUILD_BUILDPATH, EASYBUILD_INSTALLPATH, EASYBUILD_SOURCEPATH, EASYBUILD_REPOSITORYPATH and the EESSI_*_INSTALL variables name.
Everything else on the host root is read-only, and /tmp is memory.
--share DIR mounts another writable directory; --share-ro DIR mounts a read-only one that lies on a file system other than /, such as /nix.
--memory and --cpus size the guest.
Run a command as an Intel Ice Lake¶
eb-local __vm-run --mode kvm --cpu-target x86_64/intel/icelake -- grep -m1 vendor_id /proc/cpuinfo
The vendor reads GenuineIntel; QEMU keeps the host’s vendor unless the model sets it, and every detector goes wrong on an Intel model with an AMD vendor.
Run a command as a Neoverse N1¶
eb-local __vm-run --mode tcg --cpu-target aarch64/neoverse_n1 --allow-archspec-mismatch -- \
bash -c 'uname -m; gcc -mcpu=native -### -c x.c 2>&1 | grep -o -- -mcpu=[^\ ]*'
The command runs on the EESSI aarch64 compatibility layer, whose directories come first in PATH, in qemu user mode with QEMU_CPU=neoverse-n1.
uname -m reads aarch64, and the compiler names neoverse-n1.
No guest kernel boots, and no memory or CPU count applies.
QEMU’s user mode writes its own /proc/cpuinfo for the program, with the CPU part of the model, which EESSI archdetect and GCC read correctly.
Its feature line lacks evtstrm, the one feature archspec 0.2.5 requires for neoverse_n1 that the line leaves out, so archspec reads aarch64 and the helper refuses without --allow-archspec-mismatch.
An easyblock that keys on archspec then sees a generic Arm CPU while the EESSI subdirectory and the compiler see neoverse_n1; pass the option only for a command that does not use archspec’s answer.
What the helper refuses¶
The guest checks, before the command, that:
/dev/fdexists; without it EESSI archdetect fails on its process substitution and EESSI selects the generic target.The CPU vendor (
vendor_idor the Arm implementer) names the target’s.EESSI archdetect and the EESSI software subdirectory both name the target.
gcc -march=native(-mcpu=nativeon aarch64) names the target’s compiler architecture.archspec, from the EasyBuild module’s Python, names the target.
Any other reading exits 126, names the check on stderr, and does not start the command.
The helper also never uses the host CPU: enforce makes QEMU refuse a model the host cannot present, and the helper then exits 125 and says so, where a hand-run QEMU would fall back to -cpu host and report the host’s target.
Situation |
Status |
Why |
|---|---|---|
|
2 |
KVM offers no Zen 5 guest on another CPU, and on Arm only the host CPU. |
An AVX-512 target under |
2 |
TCG has no AVX-512, so the guest would be a Zen 3 to every tool. |
A target of the host’s architecture under |
2 |
|
|
125 |
|
What it costs¶
Wall times on a Ryzen 9 9950X (Zen 5) host under load, from the helper’s start to its exit, EESSI 2026.06, 8 vCPUs, 8 GiB:
Target |
Mode |
Wall time |
What ran |
|---|---|---|---|
|
kvm |
9 to 15 s |
boot, the five checks, |
|
kvm |
10 to 13 s |
the same |
|
kvm |
11 to 17 s |
the same |
|
kvm |
12 to 13 s |
the same |
|
tcg |
15 to 21 s |
the checks, |
|
tcg |
18 to 25 s |
the same, and the SVE vector length |
|
tcg |
19 s |
the same |
A guest of an SVE core reports the vector length the core has: 32 bytes (256 bits) for aarch64/neoverse_v1, 64 bytes (512 bits) for aarch64/a64fx, and none for aarch64/neoverse_n1.
Most of the time goes to the checks, which load EESSI, GCC and EasyBuild modules. A build is another matter: a guest on 4 KiB host pages and a virtiofs root costs a compile about 1.45 to 2.3 times its native time, and emulation costs 16 to 28 times.
A whole build, bzip2-1.0.8-GCCcore-15.2.0 with the audit on, through eb-local --cpu-target TARGET --mask ROUTE, on the same host while other jobs loaded it to 35 to 55 on 32 threads:
Target |
Mode |
Wall time |
Audit |
|---|---|---|---|
|
kvm |
71 s |
no instruction beyond |
|
kvm |
66 s |
no instruction beyond |
|
tcg |
191 s |
no instruction beyond |
|
tcg |
283 s |
no instruction beyond |
The two Arm targets have no cpuid profile, so the build runs only under --mask tcg --mask-allow-archspec-mismatch.