Skip to content

Setting up on Ubuntu 20.04 LTS

Alex Reinking edited this page Aug 10, 2020 · 15 revisions

This is a short guide to installing the necessary packages to fully build and package Halide on your local computer. These instructions have also been tested on the WSL Ubuntu 20.04 LTS app, available from the Microsoft Store.

These instructions also assume a fresh install.

Necessary packages

First, update your system.

dev@ubuntu:~$ sudo apt update
dev@ubuntu:~$ sudo apt upgrade

Then, install Halide's necessary build tools and dependencies.

dev@ubuntu:~$ sudo apt install \
                  build-essential git ninja-build \
                  clang-tools lld llvm-dev libclang-dev \
                  libpng-dev libjpeg-dev libgl-dev \
                  python3-dev python3-numpy python3-scipy python3-imageio \
                  libopenblas-dev libeigen3-dev libatlas-base-dev

Next, you will want the latest version of CMake (3.16+ supported):

dev@ubuntu:~$ wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null |\
              gpg --dearmor - | sudo tee /etc/apt/trusted.gpg.d/kitware.gpg >/dev/null
dev@ubuntu:~$ sudo apt-add-repository 'deb https://apt.kitware.com/ubuntu/ focal main'
dev@ubuntu:~$ sudo apt install cmake kitware-archive-keyring
dev@ubuntu:~$ sudo rm /etc/apt/trusted.gpg.d/kitware.gpg

Alternatively, you can install CMake via the Snap store:

dev@ubuntu:~$ snap install cmake

Be sure to also install the GPU drivers for your system (either Nvidia or AMD).

Get Halide & run the build

This is mostly copied from the README, so check there first if these instructions have gone stale.

dev@ubuntu:~$ git clone https://github.com/halide/Halide.git
dev@ubuntu:~$ cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -S Halide -B Halide-build
dev@ubuntu:~$ cmake --build Halide-build
dev@ubuntu:~$ (cd Halide-build ; ctest -j $(nproc))