Building TensorFlow for the IPU is very similar to the process for building TensorFlow described here: https://www.tensorflow.org/install/source.
Building TensorFlow for the IPU is supported for Ubuntu 18.04, CentOS 7.6 and CentOS 8.3.
The differences from the standard build process are:
- Install the Poplar SDK
- Use the Graphcore TensorFlow source repository
In addition to the dependencies documented for TensorFlow, you will also need to install the Poplar SDK. The Poplar SDK can be downloaded from: https://downloads.graphcore.ai/.
Set the following environment variable to point to the Poplar installation in the Poplar SDK:
$ export TF_POPLAR_BASE=/path/to/poplar_sdk/poplar-ubuntu_18_04-x.x.x
TensorFlow must be built against a compatible version of the SDK. For example, the "r2.1/sdk-release-1.3" branch of TensorFlow 2 for the IPU must be built against Poplar SDK 1.3.
Instead of downloading the TensorFlow source from the TensorFlow repository, clone Graphcore's TensorFlow GitHub repository:
$ git clone https://github.com/graphcore/tensorflow.git
$ cd tensorflow
You can now build TensorFlow by following the instructions here: https://www.tensorflow.org/install/source.
The default compilation option -march=native
optimizes the generated code for
your machine's CPU type. However, if building TensorFlow for a different CPU
type, you can use a more specific optimization option. For example, the
Graphcore TensorFlow packages distributed in the Poplar SDK are built with:
-march=skylake-avx512
for the Intel package,-march=znver1
for the AMD package. See the GCC manual for more information.
If you have built PopLibs from source and want your build of TensorFlow to use that, you can set the following environment variable:
$ export TF_POPLIBS_BASE=/path/to/poplibs/