Skip to content

pyg-lib 0.2.0: PyTorch 2.0 support, sampled operations, and further accelerations

Compare
Choose a tag to compare
@rusty1s rusty1s released this 22 Mar 13:54
· 151 commits to master since this release
930f72f

pyg-lib==0.2.0 brings PyTorch 2.0 support, sampled operations and further accelerations to PyG πŸŽ‰πŸŽ‰πŸŽ‰

Highlights

PyTorch 2.0 Support

pyg-lib==0.2.0 is fully compatible with PyTorch 2.0. To install for PyTorch 2.0, simply run

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

where ${CUDA} should be replaced by either cpu, cu117 or cu118

The following combinations are supported:

PyTorch 2.0 cpu cu117 cu118
Linux βœ… βœ… βœ…
macOS βœ…

Older PyTorch versions like PyTorch 1.11, 1.12 and 1.13 are still supported, and can be installed as described in our README.md.

Sampled Operations

We added support for sampled_op implementations (#156, #159, #160), which implements the scheme

out = left_tensor[left_index] (op) right_tensor[right_index]

efficiently without materializing intermediate representations:

from pyg_lib.ops import sampled_add

edge_index = ...
row, col = edge_index

# Replace ...
out = x[row] + x[col]

# ... with
out = sampled_add(left=x, right=x, left_index=row, right_index=col)

Supported operations are sampled_add, sampled_sub, sampled_mul and sampled_div.

Further Accelerations

  • index_sort implements a (way) faster alternative to sorting one-dimensional indices compared to torch.sort() (#181, #192). This heavily increases dataset loading times in PyG:

Screenshot 2023-03-22 at 14 46 26

image

Breaking Changes

Full Changelog

Added
  • Added PyTorch 2.0 support (#214)
  • neighbor_sample routines now also return information about the number of sampled nodes/edges per layer (#197)
  • Added index_sort implementation (#181, #192)
  • Added triton>=2.0 support (#171)
  • Added bias term to grouped_matmul and segment_matmul (#161)
  • Added sampled_op implementation (#156, #159, #160)
Changed
  • Sample the nodes with the same timestamp as seed nodes (#187)
  • Added write-csv (saves benchmark results as csv file) and libraries (determines which libraries will be used in benchmark) parameters (#167)
  • Enable benchmarking of neighbor sampler on temporal graphs (#165)
  • Improved [segment|grouped]_matmul CPU implementation via at::matmul_out and MKL BLAS gemm_batch (#146, #172)

Full commit list: 0.1.0...0.2.0