Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-gpu-driver/blob/main/qemu/bench/run.sh # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / qemu / bench / run.sh` 28 lines ยท 1550 bytes Raw Blame History 1 #!/bin/sh 2 # usage: run.sh W0BIN CMDSFILE LOG -- boots QEMU virt+SMMUv3 with 2x edu, runs /cmds, writes serial log to LOG 3 set -eu 4 [ $# -eq 3 ] || { echo "usage: $0 W0BIN CMDSFILE LOG" >&2; exit 2; } 5 B=$(CDPATH= cd -- "$(dirname "$0")" && pwd) 6 # Guest kernel: the host's own Ubuntu image, extracted without root: 7 # apt-get download linux-image-7.0.0-1019-nvidia && dpkg-deb -x linux-image-*.deb img 8 # /tmp is wiped at boot on the Spark, so there is no default path: KERNEL must name the image. 9 K=${KERNEL:?set KERNEL to the extracted vmlinuz-7.0.0-1019-nvidia} 10 [ -f "$K" ] || { echo "KERNEL=$K: no such file" >&2; exit 2; } 11 [ -f $B/initramfs.cpio.gz ] || sh $B/mkinit.sh 12 T=$(mktemp -d "$B/run.XXXXXX") 13 trap 'rm -rf "$T"' EXIT 14 mkdir "$T/x"; cp "$1" "$T/x/w0"; chmod +x "$T/x/w0"; cp "$2" "$T/x/cmds" 15 cp $B/initramfs.cpio.gz "$T/initrd" 16 (cd "$T/x" && printf 'w0\ncmds\n' | cpio -o -H newc --quiet) | gzip >> "$T/initrd" 17 boot() { # $1 = accel args 18 nice -n 19 taskset -c "${AIEN_TEST_CPUS:-0-9,15-19}" timeout ${TIMEOUT:-180} qemu-system-aarch64 \ 19 -M virt,iommu=smmuv3 $1 -smp 2 -m 1G -nographic -no-reboot \ 20 -kernel $K -initrd "$T/initrd" -append 'console=ttyAMA0 rdinit=/init panic=-1' \ 21 ${DEVICES:--device edu -device edu} 22 } 23 { echo "### accel: KVM (-cpu host -enable-kvm)"; boot "-cpu host -enable-kvm"; } > "$3" 2>&1 && rc=0 || rc=$? 24 if [ $rc -ne 0 ] || ! grep -q 'bench done' "$3"; then 25 mv "$3" "$3.kvmfail" 26 { echo "### accel: TCG (-cpu max) after KVM rc=$rc"; boot "-cpu max"; } > "$3" 2>&1 || true 27 fi 28 grep -q 'bench done' "$3"