2. Software installation

In order to run models on an IPU-POD you will need to download and install some software packages. The software can be downloaded from the Graphcore software download portal.

You need to install the Poplar SDK, which includes the development tools and also command line tools for managing the IPU hardware.

You also need to install the user-level V-IPU software.

2.1. SDK installation

Download the SDK tarball and unpack it using the following command:

$ tar -xvzf poplar_sdk-[os]-[ver].tar.gz

Where [os] is the host OS and [ver] is the software version number of the package.

You will find the following software components under the SDK installation directory:

Table 2.1 SDK contents

File or directory

Description

gc_kernel-module-[os]-[ver]

Directory containing the Graphcore drivers and utilities

tensorflow-1.15.2+[ver]-[arch].whl

File to install Graphcore port of TensorFlow v1.15 for Python 3

tensorflow-2.1.0+[ver]-[arch].whl

File to install Graphcore port of TensorFlow v2.1 for Python 3

popart-[os]-[ver]

Directory containing the PopART library for converting ONNX graphs to Poplar graphs

poplar-[os]-[ver]

Directory containing the Poplar and PopLibs libraries

The SDK installation directory also contains copies of the documentation for the software. These are provided as PDF and zipped HTML files.

The latest version of the documentation is available on the Graphcore documentation site: https://docs.graphcore.ai/.

2.2. Setting up the SDK environment

To use the Graphcore tools and Poplar libraries, several environment variables (such as library and binary paths) need to be set up, as shown below:

$ cd poplar_sdk-[os]-[ver]
$ source poplar-[os]-[ver]/enable.sh
$ source popart-[os]-[ver]/enable.sh

Where [os] is the host OS and [ver] is the current software version number of each package.

You will need to source both the Poplar and the PopART enable scripts if you are using PyTorch or PopART.

Note

Each of these scripts must be sourced every time the Bash shell is reset. If you attempt to run any Poplar software without having first enabled these scripts, you’ll get an error from the C++ compiler similar to the following (the exact message will depend on your code).

fatal error: 'poplar/Engine.hpp' file not found

You can verify that Poplar has been successfully set up by running:

$ popc --version

This will display the version number of the installed software.

PopTorch and TensorFlow for the IPU are provided as Python wheel files that can be installed using pip as described in the following sections.

2.3. Setting up PyTorch for the IPU

PopTorch is part of the Poplar SDK. It provides functions to allow PyTorch models to run on the IPU.

Before running PopTorch, you must source the enable.sh scripts for Poplar and PopART as described in Section 2.2, Setting up the SDK environment.

PopTorch is packaged as a Python wheel file that can be installed using pip.

Note

PopTorch requires pip version 18.1 or later, so it important to make sure you have the latest version before installing PopTorch.

We recommend creating a virtual environment, using virtualenv, to isolate your PopTorch environment from the system Python environment. You can create a virtual environment in a workspace directory and install PopTorch as shown below:

$ virtualenv -p python3 ~/workspace/poptorch_env
$ source poptorch_env/bin/activate
$ pip3 install -U pip
$ pip3 install poptorch-[ver].whl

Where [ver] is the SDK version version.

To confirm that PopTorch has been installed, you can use pip list, which should include the poptorch package in the output.

You can also test that the module has been installed correctly by attempting to import it in Python, for example:

$ python3 -c "import poptorch; print(poptorch.__version__)"

For more information, refer to PyTorch for the IPU: User Guide.

2.4. Setting up TensorFlow for the IPU

Before running TensorFlow, you must source the enable.sh scripts for Poplar as described in Section 2.2, Setting up the SDK environment.

To use the Graphcore port of TensorFlow, you must set up a Python virtual environment.

You can create a virtual environment in a workspace directory and install TensorFlow as shown below:

$ virtualenv -p python3.6 ~/workspace/tensorflow_env

Then activate it.

$ source tensorflow_env/bin/activate

Now all installations will be local to that virtual environment.

We support TensorFlow 1 and TensorFlow 2. There are versions of these compiled for Intel and AMD processors to provide the best performance on those hosts. As a result, there are four Python wheel files that can be installed with pip.

Warning

You must install the correct wheel file for your host CPU. You can use the command lscpu to determine the CPU type, if you are not sure.

For example, to install Graphcore’s TensorFlow distribution, compatible with v2.1.0 of TensorFlow, you would use a command similar to the following:

$ pip install tensorflow-2.1.0+[ver]+[arch].whl

Where [ver] is the TensorFlow version you have downloaded, and [arch] is the host CPU architecture (Intel or AMD).

To confirm that tensorflow has been installed, you can use pip list, which should include the tensorflow package in the output, for example:

(tensorflow_env) jsp$ pip list
Package        Version
-------------  ----------
future         0.18.2
numpy          1.19.5
pip            20.3.3
pkg-resources  0.0.0
tensorflow_env 2.1.0
setuptools     51.1.2
torch          1.6.0+cpu
wheel          0.36.2

You can also test that the module has been installed correctly by importing it in Python, for example:

$ python -c "from tensorflow.python import ipu"

For the next steps with TensorFlow, refer to the appropriate user guide:

2.5. Installing the V-IPU command-line tools

Note

You can omit this step if vipu is already installed on the system. You can check if it is installed by running vipu --version.

You can download the V-IPU client software from the Graphcore software download portal. It can be installed on any computer that can communicate with the V-IPU controller.

Extract the contents of the downloaded archive:

$ tar xzvf vipuusertools-$VERSION.tar.gz

Where $VERSION is the version of the software.

Add the directory containing the extracted package to the PATH environment variable:

$ export PATH=$PWD/vipu-$VERSION:$PATH

Now, confirm that the vipu executable is found and that it reports the expected version:

$ vipu --version