Running Virtualized Ubuntu VM on macOS
In some cases, like running a software simulated device, it can be beneficial to run the stack on a local macOS machine. This document covers the necessary setup and configuration steps to get a performant Ubuntu VM setup on Apple Silicon.
Prerequisite Steps
- UTM is the VM application we'll be using in this guide, so the first step is to download and install UTM.
- Ubuntu 22.04 ARM image download.
- Direct link: 64-bit ARM (ARMv8/AArch64) server install image
UTM Setup
- Launch UTM and click the
+
button to start a new VM. - Choose
Virtualize
(emulation works, but is unusably slow). - Under
Preconfigured
chooseLinux
. - Check box
Use Apple Virtualization
and select the ubuntu iso we just downloaded forBoot ISO Image
.
- Optionally check
Enable Rosetta
which can enable running ELF's compiled for x86 if you're interested. It's not required and additional steps are required for it to work.
- This step depends on your machine's capabilities, but it's recommended to give 16GB of memory and to use the defualt CPU Cores setting. Note this can be changed after initial setup if you want to go back and tweak settings.
- It's recommended to at least 128GB of storage, with LLVM installation and full SW stack we quickly reach 80 gigs of storage.
- Optionally choose a shared host/VM directory.
- Optionally name your new VM
ubuntu 22.04 arm64
VM Setup
- Boot your newly created VM!
- Run through the Ubuntu setup as you see fit, be sure that openssh is enabled which simplifies logging into your VM, but the rest of the defaults are sufficient.
- If you plan on using your VM via ssh you can retrieve the ip address
ip a
and looking at theinet
row underenp0s1
. Should look something likeinet 192.168.64.3
. Another tip is to add this to the host's~/.ssh/config
. - Install your normal developer tools as you see fit.
Software Stack Installation
The majority of the software install flow is the same, with the exception of a few caveats called out here.
- Installing metal deps needs the additional flags below:
git clone git@github.com:tenstorrent/tt-metal.git
cd tt-metal
sudo bash install_dependencies.sh --docker --no-distributed
--docker
: Despite not being in a docker, this is the flag that turns off configuring hugepages which is not required for VM.--no-distributed
: Currently the metal distributed feature requires a package version of openmpi that only supports x86.
- Install tt-mlir system dependencies as outlined by this step.
- The environment needs to be built manually as outlined here.
- We can then build tt-mlir per usual.
- If planning to run tests on software sim, let's build the ttrt tool.
- The following all works per usual: