Installing HalideΒΆ
For now, we recommend building Halide from source for the full functionality. Clone the repository to your local directory first:
git clone https://github.com/halide/Halide
Then follow the building instructions from the official readme.
This tutorial also uses the Python bindings. To build the Python bindings,
first build main Halide code. Then go to the python_bindings
directory, and
install the following requirements:
$ pip install numpy scipy pillow imageio pybind11
Next run
$ make
After building the Python bindings, we need to point Python to it so that we
can import halide
. Add /path/to/halide/python_bindings/bin
to your
PYTHONPATH
environment variable (e.g. export
PYTHONPATH=/path/to/halide/python_bindings/bin:$PYTHONPATH
).
There is one more step. You need to install the autoscheduler. There are
several autoschedulers in Halide but we will use the gradient_autoscheduler
as it is currently the only autoscheduler that supports GPU scheduling. From the
root directory of Halide:
$ cd apps/gradient_autoscheduler
$ make
And again add /path/to/halide/apps/gradient_autoscheduler/bin
to
PYTHONPATH
.
After this, go to the Python console and try
import halide
import libgradient_autoscheduler
If the imports are successful, you are ready!