Installation PuzzleLib on Linux and macOS

General requirements

For working with PuzzleLib, you need to install the following system dependencies:

  • С++ compiler (gcc, clang);
  • python \geq 3.5 (64-bit).

Additional requirements

CUDA (NVIDIA GPU)

For working with videocards NVIDIA required:

HIP (AMD GPU)

DNNL (Intel|AMD CPU)

  • DNNL version any of [1.1, 1.2, 1.91]

After unpacking the downloaded archive .dylib should be transferred from /lib/ to /usr/local/lib.

Important

It is not recommended to install Intel-backend via brew, because the assembly contains an outdated version of mkl-dnn.

Some library functions that are not supported by DNNL, will be executed on the numpy-backend.

TensorRT (only inference for NVIDIA GPU)

The path to the TensorRT files must be added to the TRT_PATH system variable, otherwise TensorRT will be assumed to be installed in /usr/local/cuda.

OpenVINO (only inference for Intel CPU)

The path to OpenVINO files must be added to the OPENVINO_PATH system variable, otherwise OpenVINO will be assumed to be installed in ~/openvino.

Installation from PyPI

To isntall version that runs on pure numpy backend and has stripped down functionality:

$ pip3 install PuzzleLib

There are also two options to choose from:

  • backend - what additional backend to install; possible options - cuda, hip, intel;
  • converter - what converter to prepare for accelerated inference; possible options - tensorrt, openvino.

For example:

installing cuda and hip backends:

$ pip3 install PuzzleLib --install-option="--backend=cuda,hip"

installing cuda backend and also tensorrt converter:

$ pip3 install PuzzleLib --install-option="--backend=cuda" --install-option="--converter=tensorrt"

Installing from source

Select and download the desired release on the releases page.

Unpack the archive along the path of your choice (path/to/PuzzleLib).

You can install the library by directly calling the setup.py script:

$ python3 /path/to/PuzzleLib/setup.py install --backend=cuda

Or with pip:

$ pip3 install /path/to/PuzzleLib --install-option="--backend=cuda"

To see the available installation options consult Installing from PyPI.

Tip

Changes to system variables of the console become visible only after restarting the console, so if something does not work for you, try closing-opening the console.

Backend selection

from PuzzleLib import Config
Config.backend = Config.Backend.cuda # for usage NVIDIA CUDA backend
Config.backend = Config.Backend.hip # for usage AMD ROCm backend
Config.backend = Config.Backend.cpu # for usage CPU numpy backend
Config.backend = Config.Backend.intel # for usage Intel/AMD CPU DNNL backend