Low-Level Graph Neural Network Operators for PyG
Project description
pyg-lib
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 either2.8.0,2.9.0, or2.10.0${CUDA}should be replaced by eithercpu,cu126,cu128,cu129, orcu130
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.
- Install system build tools:
sudo apt update
sudo apt install -y build-essential python3-dev python3-pip cmake ninja-build
- Install Python build dependencies:
python3 -m pip install --upgrade pip setuptools wheel ninja
- 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
- 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-libonly provides native kernels forbf16andfp16. fp16input: use CK FP16 grouped GEMM path.bf16input: use CK BF16 grouped GEMM path.fp32input: CK does not run native FP32 kernels.pyg-libfirst converts tobf16and tries CK BF16, then converts tofp16and tries CK FP16.- Since
fp32uses reduced-precision conversion on the CK path, numerical differences atbf16/fp16precision 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_outwith a warning that includes the reason. - On architectures without CK XDL support for the selected path (for example
some
gfx10targets), fallback warnings are expected.
- 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyg_lib_rocm-0.6.0.post1-cp314-cp314-manylinux_2_32_x86_64.whl.
File metadata
- Download URL: pyg_lib_rocm-0.6.0.post1-cp314-cp314-manylinux_2_32_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.14, manylinux: glibc 2.32+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd5a5cb1034f68e5fa0a8c64ab55f4167456995a60d414517978575718b88a43
|
|
| MD5 |
ee5098209617af7137e334e602a114a8
|
|
| BLAKE2b-256 |
a267b571768da56cd81c45ff2efe2a3e6e68182fe5def69646454fa11fad338a
|
File details
Details for the file pyg_lib_rocm-0.6.0.post1-cp313-cp313-manylinux_2_32_x86_64.whl.
File metadata
- Download URL: pyg_lib_rocm-0.6.0.post1-cp313-cp313-manylinux_2_32_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.13, manylinux: glibc 2.32+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ebba7502d25e3c5d4dda5df643c93ebece659c73f2a48f7cee8997d0eebadc3
|
|
| MD5 |
5d248a29ac4910b5d49a3b3c97c1a029
|
|
| BLAKE2b-256 |
cb9a8a5feafadd3d3b172444edb62b3ee0b04f2f5325073d482e464d4c4e6fe2
|
File details
Details for the file pyg_lib_rocm-0.6.0.post1-cp312-cp312-manylinux_2_32_x86_64.whl.
File metadata
- Download URL: pyg_lib_rocm-0.6.0.post1-cp312-cp312-manylinux_2_32_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.12, manylinux: glibc 2.32+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ae6fade5b3f82843e2f176d903c42fcc5f7399408c5f5976d269868b41718d2
|
|
| MD5 |
6b74dbbada2744c2d5fff0d220a569e8
|
|
| BLAKE2b-256 |
db75e57d36ae080fbb910c978a56c9bd3dfe6612feaeb562239c239fe857718d
|
File details
Details for the file pyg_lib_rocm-0.6.0.post1-cp311-cp311-manylinux_2_32_x86_64.whl.
File metadata
- Download URL: pyg_lib_rocm-0.6.0.post1-cp311-cp311-manylinux_2_32_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.11, manylinux: glibc 2.32+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6b47a8a24fbdf2682f15fa137c02287130b3f04b792269d287603185d6e2ae18
|
|
| MD5 |
fe9a961566f37e0f44f1a88d507fc3a2
|
|
| BLAKE2b-256 |
b9a87ecfd6c406ca6ce3964b6f7207c87ba9453e5952df3f82fd37051ed1bee7
|
File details
Details for the file pyg_lib_rocm-0.6.0.post1-cp310-cp310-manylinux_2_32_x86_64.whl.
File metadata
- Download URL: pyg_lib_rocm-0.6.0.post1-cp310-cp310-manylinux_2_32_x86_64.whl
- Upload date:
- Size: 2.8 MB
- Tags: CPython 3.10, manylinux: glibc 2.32+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
101cc039e197f994f30a2147ccd247beeaafc3063107a27daa658d625c054bd3
|
|
| MD5 |
7536461787566b85e5b7291a221b3bed
|
|
| BLAKE2b-256 |
a3fe5a09aedad722aebb5564b1a99a974c6edd51174907671efde0eb373462ef
|