Skip to main content

Low-Level Graph Neural Network Operators for PyG

Project description

pyg-lib

Docs Status Code Coverage Slack Contributing

Installation

We provide pre-built Python wheels for all major OS/PyTorch/CUDA combinations from Python 3.10 till 3.13, see here.

To install the wheels for CPU/CUDA backend, simply run

pip install pyg-lib -f https://data.pyg.org/whl/torch-${TORCH}+${CUDA}.html

where

  • ${TORCH} should be replaced by either 2.8.0, 2.9.0, or 2.10.0
  • ${CUDA} should be replaced by either cpu, cu126, cu128, cu129, or cu130

The following combinations are supported:

PyTorch 2.10 cpu cu126 cu128 cu129 cu130
Linux
Windows
macOS
PyTorch 2.9 cpu cu126 cu128 cu129 cu130
Linux
Windows
macOS
PyTorch 2.8 cpu cu126 cu128 cu129 cu130
Linux
Windows
macOS

For ROCM backend, there is an external pyg-rocm-build repository provides wheels and detailed instructions on how to install PyG for ROCm. If you have any questions about it, please open an issue here.

Note: ROCM backend only support Linux up to now.

Build from source on a ROCm machine (Linux)

The following steps build and install pyg-lib with ROCm/HIP support from source. Ensure your ROCm installation includes hipblaslt, rocblas, rocprim, rocthrust, and composable_kernel.

  1. Install system build tools:
sudo apt update
sudo apt install -y build-essential python3-dev python3-pip cmake ninja-build
  1. Install Python build dependencies:
python3 -m pip install --upgrade pip setuptools wheel ninja
  1. Install a ROCm-enabled PyTorch build (matching your ROCm stack):
# Example:
# python3 -m pip install torch torchvision --index-url https://download.pytorch.org/whl/rocm6.3
  1. Configure environment variables:
export ROCM_PATH=/opt/rocm
export CMAKE_PREFIX_PATH="${ROCM_PATH};${ROCM_PATH}/lib/cmake"
export FORCE_ROCM=1
export FORCE_CUDA=0

# Set your GPU architecture, for example gfx90a/gfx942/gfx1100:
export PYTORCH_ROCM_ARCH="gfx1100;gfx950;gfx942;gfx90a;gfx908;gfx1201;gfx1101;gfx1030"
# Alternatively, you can use:
# export AMDGPU_TARGETS=gfx90a;gfx950;gfx942;gfx90a;gfx908;gfx1201;gfx1101;gfx1030
# If your hipcc does not recognize one of the targets, remove that target.

# Optional: disable CK grouped matmul path (enabled by default).
# export PYG_ROCM_MATMUL_USE_CK=0
# Optional: require CK path (fail fast if fallback would happen).
# export PYG_ROCM_MATMUL_REQUIRE_CK=1

grouped_matmul / segment_matmul behavior on ROCm:

  • Important: The CK backend in pyg-lib only provides native kernels for bf16 and fp16.
  • fp16 input: use CK FP16 grouped GEMM path.
  • bf16 input: use CK BF16 grouped GEMM path.
  • fp32 input: CK does not run native FP32 kernels. pyg-lib first converts to bf16 and tries CK BF16, then converts to fp16 and tries CK FP16.
  • Since fp32 uses reduced-precision conversion on the CK path, numerical differences at bf16/fp16 precision are expected.
  • PYG_ROCM_MATMUL_USE_CK=0: disable CK grouped matmul and use ATen matmul.
  • PYG_ROCM_MATMUL_REQUIRE_CK=1: strict mode. If no CK path is accepted, an error is raised instead of falling back.
  • Without strict mode, unsupported CK shapes/targets fall back to at::mm_out with a warning that includes the reason.
  • On architectures without CK XDL support for the selected path (for example some gfx10 targets), fallback warnings are expected.
  1. Build and install:
python3 -m pip install -v .

For editable/development install:

python3 -m pip install -v -e .

Optional check:

python3 -c "import torch; print(torch.version.hip)"

From nightly

Nightly wheels are provided for Linux from Python 3.10 till 3.13:

pip install pyg-lib -f https://data.pyg.org/whl/nightly/torch-${TORCH}+${CUDA}.html

From master

pip install ninja wheel
pip install --no-build-isolation git+https://github.com/pyg-team/pyg-lib.git

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 Distributions

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

pyg_lib_rocm-0.6.0.post2-cp314-cp314-manylinux_2_32_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.6.0.post2-cp313-cp313-manylinux_2_32_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.6.0.post2-cp312-cp312-manylinux_2_32_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.6.0.post2-cp311-cp311-manylinux_2_32_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.6.0.post2-cp310-cp310-manylinux_2_32_x86_64.whl (2.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.32+ x86-64

File details

Details for the file pyg_lib_rocm-0.6.0.post2-cp314-cp314-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.6.0.post2-cp314-cp314-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 6dcf91faa439eedd06142429ca428d29abd17d80ae7157e0006557bfc8963243
MD5 a1d8404c3e0692ad0c9e28a5f0a4a6ea
BLAKE2b-256 2c8888263539ce5a97e3cb8d9ed65770e7abed0b61f68c32e85017c9832db1ff

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.6.0.post2-cp313-cp313-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.6.0.post2-cp313-cp313-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 3979cc03d38f1aeb5fe8b7f606276532f4c0b6cbe2f42f1e44b47f12c7940b8a
MD5 34afdadca8dec8a784c7ce577866674e
BLAKE2b-256 c65e0e396442093381bf01ddd7855beb3161c60a1d4732783b2b099da0eaa21b

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.6.0.post2-cp312-cp312-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.6.0.post2-cp312-cp312-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 7759e617c3d4288eb0b1bcc77db06e155c79fa6b1aba5cc61d2af2c5c59251fa
MD5 45a11b43504d8022fbfe979204d22307
BLAKE2b-256 278ff4585db77da84c76f57e8ab9137395251df63f641e6fc124c0bcdf5333e5

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.6.0.post2-cp311-cp311-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.6.0.post2-cp311-cp311-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 b67ec47212173c3bb03bec11d8a1822a8648ec6b196d6ab2ba8066895bebdb7e
MD5 3fe8e8b257693fa312f816671c2e6c63
BLAKE2b-256 2960c305d56c32859571ef849c335739cd70896995a67e45d4ed14d43c27b23e

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.6.0.post2-cp310-cp310-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.6.0.post2-cp310-cp310-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 72110c888bacbb331b1c5a3b8ed33860a55fd5684131a49d8df68d9dbb639d11
MD5 b08375d4f0eb7d53f949687d637858f8
BLAKE2b-256 13c93f9e43b4ee20569fbbe4795058c03562a93f1f13c84058131b6ea0d71cbe

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