2. Software installation

You need to install the Poplar SDK, which includes the development tools and some command line tools for managing the IPU hardware. The software can be downloaded from the Graphcore software download portal.

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.

The main components under the SDK installation directory are shown in Table 2.1.

Table 2.1 SDK contents

File or directory

Description

gc_kernel-module-[os]-[ver]/

Directory containing the Graphcore drivers and utilities.

popart-[os]-[ver]/

Directory containing the PopART framework.

poplar-[os]-[ver]/

Directory containing the Poplar graph programming framework and PopLibs libraries

docs/

HTML and PDF documentation for the SDK tools and libraries. The documentation on the Graphcore documentation portal may contain updates made after the SDK release and includes other documents not packaged with the SDK.

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

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

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

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

poptorch-[ver]-[arch].whl

File to install PopTorch (to run PyTorch models on the IPU).

horovod-[ver].whl

File to install Horovod to support distributed training in PopART (see Distributed training with Horovod for more information).

poplibs-source-code-[ver].zip

Source code for the PopLibs libraries (also available on GitHub).

license.html

The Graphcore end user license agreement (EULA).

release_notes.*

Release notes for this version of the SDK, in HTML and XML (Docbook) format.

Note

There are two versions of each of the TensorFlow wheel files, optimised for Intel and AMD processors respectively. These are indicated by the arch component of the filename. You must install the correct wheel file for your host processor type.

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: