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.14, 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.10.0, 2.11.0, or 2.12.0
  • ${CUDA} should be replaced by either cpu, cu126, cu128, cu130, or cu132

The following combinations are supported:

PyTorch 2.12 cpu cu126 cu128 cu130 cu132
Linux
Windows
macOS
PyTorch 2.11 cpu cu126 cu128 cu130
Linux
Windows
macOS
PyTorch 2.10 cpu cu126 cu128 cu130
Linux
Windows
macOS
PyTorch 2.9 cpu cu126 cu128 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.14:

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.8.0-cp314-cp314-manylinux_2_32_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.8.0-cp313-cp313-manylinux_2_32_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.8.0-cp312-cp312-manylinux_2_32_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.8.0-cp311-cp311-manylinux_2_32_x86_64.whl (7.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.32+ x86-64

pyg_lib_rocm-0.8.0-cp310-cp310-manylinux_2_32_x86_64.whl (7.1 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.32+ x86-64

File details

Details for the file pyg_lib_rocm-0.8.0-cp314-cp314-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.8.0-cp314-cp314-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 fe9f9524583ae95c060e1853ecbab409204b869168f9de227f2572f7f97fb10e
MD5 99a2cf8640b3faff56da2cdc3898dc36
BLAKE2b-256 38af169dde619fe735aa88023fdfc9902e3d8ca081ff2f73a9063252c5bbfad5

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.8.0-cp313-cp313-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.8.0-cp313-cp313-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 fc751e4d58d06fbdb4feb56467d69515fd03b52fcb31c4779a66920e65288c07
MD5 586b349c311a68c63c3bd598867b0d6f
BLAKE2b-256 2cceede69b7341fac0a950cd1dc49a66342633710a3d21c2cd183ddf75a587ad

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.8.0-cp312-cp312-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.8.0-cp312-cp312-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 b6d5a11d73c600360b2376036261005d55ccc82caf5f24ca9b9ec831070cd5d1
MD5 cfe1eea6fda45ee4072a97ac5c97dad3
BLAKE2b-256 ff5a68cd855654bcdd68066fec8ce1716e86256241be282873f230cdc9459d2e

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.8.0-cp311-cp311-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.8.0-cp311-cp311-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 ed71700206a8d5fd6d16354dddaa2a27b8efde8703fd9158da429ddfa759a1f0
MD5 64f31961ff0025dbbdf13c50a0cadcc4
BLAKE2b-256 eee48baaee51bf6d9019f3197db739ace7af5a18388d9acaa730e2479a3dab2b

See more details on using hashes here.

File details

Details for the file pyg_lib_rocm-0.8.0-cp310-cp310-manylinux_2_32_x86_64.whl.

File metadata

File hashes

Hashes for pyg_lib_rocm-0.8.0-cp310-cp310-manylinux_2_32_x86_64.whl
Algorithm Hash digest
SHA256 e6f575cf5f9336027ee34aff739f0c2e90ca34c5df34de7ecf791a74d123ca74
MD5 f7b3f7c20fd6b2a4c718dcef7d00b0be
BLAKE2b-256 c809c563db2373c9dc9ba04a44b36602dc7a449ae42de05608fa1240d421e50c

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