Skip to main content

GPU-accelerated PennyLane simulator for Apple silicon, built on Metal 4

Project description

PennyLane Metal

PennyLane Metal is a PennyLane quantum simulator for Apple silicon, built exclusively on Metal 4. It provides the metal.qubit device, where state evolution, noise channels, measurements, sampling, and adjoint gradients all run on the GPU.

  • Pure circuits use a state vector; noisy circuits use a density-matrix execution model, selected automatically.
  • Native Metal adjoint Jacobians and VJPs for the parameterized gate set.
  • Broad native gate, measurement, and noise-channel coverage — see supported operations.
  • Device-aware memory admission with a queryable resource planner — see memory and resources.

Requirements

  • macOS 26.0 or newer on Apple silicon
  • A Metal 4-capable Apple GPU (M1 or newer)
  • Python 3.10–3.14

Installation

pip install pennylane-metal

Binary wheels are published for macOS 26+ (arm64) and CPython 3.10–3.14.

Building from the sdist or a git checkout additionally requires Xcode 26 with the Metal Toolchain component (xcodebuild -downloadComponent MetalToolchain) and CMake 3.24+; then pip install .. See docs/DEVELOPMENT.md for the full workflow.

Quickstart

import pennylane as qml

dev = qml.device("metal.qubit", wires=2)

@qml.qnode(dev)
def bell_state():
    qml.H(0)
    qml.CNOT([0, 1])
    return qml.probs(wires=[0, 1])

print(bell_state())  # [0.5, 0.0, 0.0, 0.5]

Gradients use the native Metal adjoint method:

@qml.qnode(dev, diff_method="adjoint")
def expectation(angle):
    qml.RX(angle, 0)
    qml.CNOT([0, 1])
    return qml.expval(qml.Z(0))

angle = qml.numpy.array(0.37, requires_grad=True)
print(qml.grad(expectation)(angle))  # -sin(0.37)

Performance

A 22-qubit, depth-10 RY/CNOT circuit with an analytic expectation value (Apple M1 Max, macOS 26, pennylane-metal 0.2.0):

Device Time per execution
default.qubit 5808 ms
lightning.qubit 973 ms
metal.qubit 98 ms

Each execution carries a fixed ~1 ms GPU dispatch cost, so CPU simulators remain faster for very small circuits; the GPU advantage grows with qubit count and depth. Reproduce with benchmarks/benchmark_metal.py — see docs/DEVELOPMENT.md.

Capabilities and limits

Area Summary
Gates Native one/two/multi-qubit set incl. excitation families, arbitrary unitaries
Measurements State, probs, expval, var, purity, entropies (analytic); shots via Metal sampling
Noise Standard channels plus arbitrary multi-wire Kraus maps, all on GPU
Gradients Native adjoint/VJP (pure states); parameter-shift for noisy circuits
Precision complex64; capacity is device-memory-bound (2**n state vector, 4**n density matrix)
Not supported Mid-circuit measurements, reset, postselection, classical conditionals

Full details: docs/SUPPORTED_OPERATIONS.md and docs/RESOURCES.md.

Documentation

Development

python -m venv .venv
.venv/bin/pip install -e '.[dev]'
.venv/bin/pytest

See docs/DEVELOPMENT.md for CMake iteration builds, Metal API validation runs, and the release process.

License

Apache 2.0

Project details


Download files

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

Source Distribution

pennylane_metal-0.2.1.tar.gz (120.5 kB view details)

Uploaded Source

Built Distributions

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

pennylane_metal-0.2.1-cp314-cp314-macosx_26_0_arm64.whl (411.1 kB view details)

Uploaded CPython 3.14macOS 26.0+ ARM64

pennylane_metal-0.2.1-cp313-cp313-macosx_26_0_arm64.whl (410.6 kB view details)

Uploaded CPython 3.13macOS 26.0+ ARM64

pennylane_metal-0.2.1-cp312-cp312-macosx_26_0_arm64.whl (410.6 kB view details)

Uploaded CPython 3.12macOS 26.0+ ARM64

pennylane_metal-0.2.1-cp311-cp311-macosx_26_0_arm64.whl (408.4 kB view details)

Uploaded CPython 3.11macOS 26.0+ ARM64

pennylane_metal-0.2.1-cp310-cp310-macosx_26_0_arm64.whl (406.7 kB view details)

Uploaded CPython 3.10macOS 26.0+ ARM64

File details

Details for the file pennylane_metal-0.2.1.tar.gz.

File metadata

  • Download URL: pennylane_metal-0.2.1.tar.gz
  • Upload date:
  • Size: 120.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pennylane_metal-0.2.1.tar.gz
Algorithm Hash digest
SHA256 4312706760d13c68cf0997340185f5de2bc2e699b608c6b0bdaef8df07c4861d
MD5 2659756986f0de7c81f718fafc461d09
BLAKE2b-256 c2fb2489eb6fc8370097977276de495e36b24f9f21771f313ff7407d44398c76

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1.tar.gz:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_metal-0.2.1-cp314-cp314-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pennylane_metal-0.2.1-cp314-cp314-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 5e6e983103d31f20af9d074c576ac8e1afad8c1e1c4f4dabccb4edad0653ebb3
MD5 73b443909aa9bc58c833482cf38e66e2
BLAKE2b-256 924219b25dd1ad4988d484abae52d9b80281a219eb402d6b8bc6228fa4ed0564

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1-cp314-cp314-macosx_26_0_arm64.whl:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_metal-0.2.1-cp313-cp313-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pennylane_metal-0.2.1-cp313-cp313-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 9203cf4e36725c4b353808a622d6af30422ad09fb5752bcf5d12307148d0beab
MD5 d8dff112071d82aa45deb473fe5d9c66
BLAKE2b-256 0656a23288b07bda628c5c0106136aafa865b51649ad9b619fe7464298d5682f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1-cp313-cp313-macosx_26_0_arm64.whl:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_metal-0.2.1-cp312-cp312-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pennylane_metal-0.2.1-cp312-cp312-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 5a1ecc7428ab753eb3a1ef078a6259a5c4dad4bb0e46af98374d3fcf9d5bc58b
MD5 ffbe4dff97f92ea4475f86f2901af605
BLAKE2b-256 ab61834d9b4c4904683e7ebe7b307148050ece8bb97401970ab3242a3cb585ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1-cp312-cp312-macosx_26_0_arm64.whl:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_metal-0.2.1-cp311-cp311-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pennylane_metal-0.2.1-cp311-cp311-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 893251cb6044ef902bd513d7a1e263c285b3f5bbfdc2427f5922be627ad0c4d3
MD5 2f8c77758988d732905ece294dec65f6
BLAKE2b-256 de43c526b621c99bd02fc5b0f7e22de5ae1e25d1fc8b80f1b8c72390855e48bc

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1-cp311-cp311-macosx_26_0_arm64.whl:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pennylane_metal-0.2.1-cp310-cp310-macosx_26_0_arm64.whl.

File metadata

File hashes

Hashes for pennylane_metal-0.2.1-cp310-cp310-macosx_26_0_arm64.whl
Algorithm Hash digest
SHA256 786ec749ba227366f39e6603a417acc66a1bfb35cbd96406ea279de3e37146f8
MD5 2992166481d54ea89fd923fa9411db27
BLAKE2b-256 c64d8c03f081924c3211af844737c0c09fa028c552051fe3d4bbfdbdc76a0cc6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pennylane_metal-0.2.1-cp310-cp310-macosx_26_0_arm64.whl:

Publisher: wheels.yml on dereklei12/pennylane-metal

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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