Skip to main content

Intel® XPU Library for PyTorch* Ecosystem Projects

Project description

OpenSSF Scorecard Coverity Scan Build Status

Intel® XPU Library for PyTorch* Ecosystem Projects

This project contains a set of plugins for PyTorch* ecosystem libraries which enable hardware acceleration on Intel® GPUs thru the xpu PyTorch* device backend. The goal of the project is to:

  • Facilitate enabling of the Intel® GPUs support across PyTorch* ecosystem projects
  • Provide the plugins till the support for Intel® GPUs will be accepted in the respective upstream projects

At the moment project provides plugins for the following frameworks:

Plugins

Intel® XPU plugin for TorchCodec

TorchCodec is a high-performance Python library designed for media processing (decoding and encoding) using PyTorch* tensors. Intel® XPU plugin for TorchCodec enables hardware acceleration for video operations (only decoding at the moment) on Linux. Both TorchCodec and Intel® plugin rely on the FFmpeg libraries for their operations which must be pre-installed on the system. Intel® plugin further assumes that FFmpeg is built with the VAAPI support.

To use Intel® XPU plugin for TorchCodec, load it in the Python script and pass XPU device to initialize TorchCodec decoder or encoder:

import torchcodec
import torchcodec_xpu

decoder = torchcodec.decoders.VideoDecoder(
    "input.mp4", device="xpu:0")

Installation

Pre-built release wheels are available at PyPI. Installation requires PyTorch with enabled XPU support which can be fetched from https://download.pytorch.org/whl/xpu:

pip install torchlib-xpu \
  --extra-index-url https://download.pytorch.org/whl/xpu

Build from sources

  • Install uv

  • Install oneAPI 2025.3

  • Install FFmpeg development environment with enabled VAAPI hardware acceleration. For example:

    • By installing FFmpeg provided by your Linux distribution. For Ubuntu:
apt-get update && apt-get install -y \
    libavcodec-dev \
    libavdevice-dev \
    libavfilter-dev \
    libavformat-dev \
    libavutil-dev \
    libswresample-dev \
    libswscale-dev
  • By self-building FFmpeg from sources:
git clone https://git.ffmpeg.org/ffmpeg.git && cd ffmpeg
./configure \
  --prefix=$HOME/_install \
  --libdir=$HOME/_install/lib \
  --disable-static \
  --disable-stripping \
  --disable-doc \
  --enable-shared \
  --enable-vaapi
make -j$(nproc) && make install

export PKG_CONFIG_PATH=$HOME/_install/lib/pkgconfig
export LD_LIBRARY_PATH=$HOME/_install/lib:$LD_LIBRARY_PATH
  • Build and install plugins supplied by Intel® XPU Library for PyTorch* Ecosystem Projects:
git clone https://github.com/intel/torchlib-xpu.git && cd torchlib-xpu

uv venv && uv pip install -e . \
  --index https://download.pytorch.org/whl/xpu -vv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

torchlib_xpu-0.2.0-py3-none-any.whl (4.3 kB view details)

Uploaded Python 3

File details

Details for the file torchlib_xpu-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: torchlib_xpu-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.9.6 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.65.0 urllib3/1.26.18 CPython/3.10.12

File hashes

Hashes for torchlib_xpu-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a65fbc37479fa56df7c560cced9e3e511959fe7c9f2c861160bdb55f6eb0976a
MD5 6736cc2cad408586b99e475e11c59b78
BLAKE2b-256 168776220f246b6bea0667d5500efdd4ac77fcbc216d22eca9cc056ca99024e7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page