IPUToolkit.jl
IPUToolkit.jl
allows you to interface the Intelligence Processing Unit (IPU) by Graphcore using the Julia programming language.
The main motivation for this project is to explore Julia's introspection and metaprogramming capabilities to write high-level code for the IPU using an alternative method to the tools developed by Graphcore, and leverage code-generation through LLVM to generate efficient code for the device: also the IPU compiler is based on this framework, so the LLVM IR constitutes a common language between Julia and the IPU compiler.
This effort is not officially endorsed by Graphcore, although we gracefully received help through the public Graphcore support channels. This package is currently a proof-of-concept, not suitable for production usage. Its API may be subject to frequent development and breaking changes.
This package was initially created by Emily Dietrich and Luk Burchard, and later expanded by Mosè Giordano. Mosè's work on this package was funded by UCL Centre for Advance Research Computing.
Requirements
This package requires
- Julia v1.6+ (currently tested up to Julia v1.10),
- the Poplar SDK v1.3 or v2.0-v3.2 including the
popc
compiler, - a C++ compiler supporting C++17 standard for compiling the wrapper around the Poplar SDK (e.g. G++ 9 or following releases).
Other versions of the Poplar SDK are not currently supported.
Both Julia and the Poplar SDK are coupled to a specific version of the LLVM compiler framework, and you will need to match a specific version of the Poplar SDK with a version of Julia using the same major version of LLVM. For example
- the Poplar SDK version 2.2 uses LLVM 13, which is available in Julia v1.8;
- the Poplar SDK versions 2.3-2.5 use LLVM 14, which is available in Julia v1.9;
- the Poplar SDK versions 2.6-3.2 use LLVM 15, which is available in Julia v1.10;
- the Poplar SDK version 3.3 uses LLVM 16, which is available in Julia v1.11 (NOTE: this combination has ***not*** been tested yet and is likely not to work at the moment).
Installation
To install the package, run the commands
using Pkg
Pkg.add("IPUToolkit")
You will need to build the wrapper around the Poplar SDK. This should happen automatically the first time you install the package, in any case you can run it with
Pkg.build()
This step requires a C++ compiler supporting C++17 standard. You have to set the compiler with the CXX
environment variable, this can be either its absolute path or simply its name if it is in the PATH
environment variable. The compiler must be able to find Poplar header files automatically, depending on your installation of the Poplar SDK you may have to add its include/
directory to the CPATH
environment variable, but this should be done automatically by the script to activate a Poplar SDK.
Compiling the wrapper around the Poplar SDK will take several minutes (up to about 7 minutes, depending on the Poplar version), without printing any progress to screen. Hold on.
Usage
The package is called IPUToolkit because it provides different tools to interface the IPU from Julia:
- you can use functionalities in the Poplar SDK;
- you can use Julia's code generation capabilities to automatically compile native code that can be run on the IPU;
- there is a small embedded Domain-Specific Language (eDSL) to automatically generate the code of a program.
These approaches are exploratory of the functionalities, and are often limited in scope and are described in more details in the following sections.
Talks and demos
Here is some material that you may find useful for learning more about Julia on the IPU and trying it out yourself:
- Pluto notebook of presentation given at Graphcore and at JuliaCon in July 2023
- Talk "Julia meets the Intelligence Processing Unit" at JuliaCon 2023
- Talk "Automatic differentiation on the IPU with Enzyme.jl" at EnzymeCon 2024