PennyLaneAI / pennylane

PennyLane is a cross-platform Python library for quantum computing, quantum machine learning, and quantum chemistry. Train a quantum computer the same way as a neural network.
https://pennylane.ai
Apache License 2.0
2.3k stars 591 forks source link

Create JIT compiled device #1521

Closed mlxd closed 1 year ago

mlxd commented 3 years ago

Feature details

As PennyLane has support for multiple plugins to provide simulation of quantum circuits using a variety of different software and hardware devices, there can be many ways to reduce call overheads for circuits with many repeated gate-calls. One such method is the use of just-in-time compilation techniques. This task requires the use of the Numba library to develop a PennyLane device which allows JIT compilation of gate-calls. The device is to be called "numba.qubit", and will be compared against the existing implementations for "default.qubit" and the C++ backend "lightning.qubit".

Implementation

How important would you say this feature is?

1: Not important. Would be nice to have.

Additional information

To understand the impact of JIT compilation on running circuits, the new device should also be benchmarked against the existing "default.qubit" and "lightning.qubit" devices (see here for info on installing and using lightning).

arshpreetsingh commented 3 years ago

Hi @mlxd
Quick Question, Will there be new interface as well something like pennylane/interface/numba.py ?

josh146 commented 3 years ago

@arshpreetsingh nope, Numba does not support autodifferentiability 🙂

Instead, the Numba device can be used with existing interfaces. E.g., using the Torch interface with the Numba device will allow for users to use this new device with torch.tensor objects.