Install Native Frameworks

Installing frameworks with docker is the recommended installation method and does not require additional steps.

TensorFlow Installation

This section describes how to obtain and install the TensorFlow software package. Follow these instructions if you want to install the TensorFlow packages on a Bare Metal platform without a Docker image. The package consists of two main components:

  • Base habana-tensorflow Python package - Libraries and modules needed to execute TensorFlow on a single Gaudi device.

  • Scale-out habana-horovod Python package - Libraries and modules needed to execute TensorFlow on a single-node machine.

Setting Up the Environment

Habana TensorFlow support package consists of two Python Packages. Installing both packages guarantees the same functionality delivered with TensorFlow Docker:

  • habana-tensorflow - execute TensorFlow on a single Gaudi device

  • habana-horovod - execute TensorFlow on a single-node machine

  1. To set up the environment, the SynapseAI On-Premise software package must be installed first. Manually install the components listed in Set up On Premise before installing the Habana TensorFlow package.

  2. To prepare Habana TensorFlow environment, download and execute bash script tensorflow_installation.sh. This script works only for currently supported Operating Systems specified in Support Matrix.

By installing Habana TensorFlow environment, the following will be performed throughout the execution:

  • Auto-detect OS type and supported Python version for which packages are present on the Python Package Index (PyPI).

  • Try to auto-detect SynapseAI software version and build number based on installed packages.

  • Install OS specific dependent deb/rpm packages.

  • (Disabled by default) Install extra Model references requirements. See Model References Requirements.

  • Download and install Open MPI and mpi4py package.

  • Set the MPI_ROOT environment variable for use in the command line

  • Uninstall any existing TensorFlow package.

  • Uninstall existing Habana TensorFlow Python packages.

  • Install recommended TensorFlow package (configurable via --tf parameter).

  • Install Habana TensorFlow Python packages matching the SynapseAI software package.

  • Add required environment variables in /etc/profile.d/habanalabs.sh and source /etc/profile.d/habanalabs.sh in ~/.bashrc.

  • Run simple TensorFlow workload with Habana TensorFlow and validates that it has been executed on Habana Gaudi.

  1. Set up the Habana Media Loader using the following command. For more details, refer to Habana Media Loader:

  pip install hpu_media_loader-1.5.0-610-py3-none-any.whl

Note

tensorflow_installation.sh accepts optional input parameters that can also override auto-detection described above. Run ./tensorflow_installation.sh --help for more details.

Model References Requirements

Habana provides a number of model references optimized to run on Gaudi. Those models are available at Model-References page.

Many of the references require additional 3rd party packages, not provided by Habana. This section describes how to install the required 3rd party packages.

There are two types of packages required by the Model References:

  • System packages - installed with OS packet manager (e.g. apt in case of Ubuntu). To install system packages, run installation script with --extra_deps argument: ./tensorflow_installation.sh --extra_deps.

  • Python packages - installed with pip tools. Packages required to run topologies from Model References repository are defined in per-topology requirements.txt files in each folder containing the topologies’ scripts.

PyTorch Installation

This section describes how to obtain and install the PyTorch software package. Follow the instructions outlined below to install PyTorch packages on a bare metal platform or virtual machine without a Docker image.

Habana PyTorch packages consist of:

  • torch - PyTorch framework package with Habana support

  • habana-torch-plugin - Libraries and modules needed to execute PyTorch on single card, single node and multi node setup.

  • habana-torch-dataloader - Habana multi-threaded dataloader package.

  • pytorch-lightning - PyTorch Lightning package with Habana support.

  • torchvision - Torchvision package compiled in torch environment. No Habana specific changes in this package.

Setting Up the Environment

  1. To set up the environment, the SynapseAI On-Premise software package must be installed first. Manually install the components listed in Set up On-Premise before installing the PyTorch package.

  2. To setup Habana PyTorch environment, download and execute bash script pytorch_installation.sh.

By installing the PyTorch environment, the below will be performed throughout the execution:

  • Autodetect OS type and the supported python version for which Habana PyTorch wheel packages are present in Vault.

  • Try to autodetect Habana software version and build number.

  • Install OS specific dependent deb/rpm packages.

  • Download and install Open MPI and mpi4py package.

  • Set the MPI_ROOT environment variable for use in the command line

  • Download tar ball file that will have the PyTorch specific packages from the Habana Vault.

  • Install requirements-pytorch.txt which exists inside tar ball.

  • Uninstall torch, as it will be installed by deafult while installing requirements-pytorch.txt.

  • Install Habana PyTorch python packages.

  • Uninstall pillow package and install pillow-simd.

  • Add the required environment variables in /etc/profile.d/habanalabs.sh and source /etc/profile.d/habanalabs.sh in ~/.bashrc.

  1. Set up the Habana Media Loader using the following command. For more details, refer to Habana Media Loader:

  pip install hpu_media_loader-1.5.0-610-py3-none-any.whl

Note

Refer to the Support Matrix to view the supported python version for each of the Operating Systems.

Command Line Usage

The following are examples of CLI usage when executing PyTorch packages:

  • To autodetect OS type, Habana Software version and build number, use ./pytorch_installation.sh.

  • To download and install specific version and build, use ./pytorch_installation.sh -v 1.5.0-610.

The Supported Options:

  • -v <software version> - Habana software version eg 1.5.0

  • -b <build/revision> - Habana build number eg: 148 in 1.2.0-148

  • -os <os version> - OS version <ubuntu2004/ubuntu1804/amzn2/rhel79/rhel83.

  • -ndep - do not install rpm/deb dependencies.

  • -sys - install python packages without --user.

  • -u - install python packages with --user.

Note

Some PyTorch models need additional python packages. They can be installed using python requirements files provided in Model References repository. Refer to Model References repository for detailed instructions on running PyTorch models.