Giter Site home page Giter Site logo

iqm-finland / cirq-on-iqm Goto Github PK

View Code? Open in Web Editor NEW
22.0 10.0 8.0 39.66 MB

Cirq adapter for IQM's quantum computers

Home Page: https://iqm-finland.github.io/cirq-on-iqm/

License: Apache License 2.0

Python 98.52% Shell 1.48%
quantum-computing quantum-algorithms cirq

cirq-on-iqm's Introduction

CI badge Release badge Black badge

Cirq on IQM

Google Cirq adapter for IQM's quantum architectures.

What is it good for?

Currently Cirq on IQM can

  • take an arbitrary quantum circuit created using Cirq or imported from an OpenQASM 2.0 file
  • map the circuit into an equivalent one compatible with the chosen IQM quantum architecture
  • optimize the circuit by commuting and merging gates
  • simulate the circuit using one of Cirq's simulators
  • run the circuit on an IQM quantum computer

Installation

The recommended way is to install the distribution package cirq-iqm directly from the Python Package Index (PyPI):

$ pip install cirq-iqm

Documentation

The documentation of the latest Cirq on IQM release is available here.

Jump to our User guide for a quick introduction on how to use Cirq on IQM.

Take a look at the Jupyter notebook with examples: examples/usage.ipynb.

You can build documentation for any older version locally by cloning the Git repository, checking out the corresponding tag, and running the docs builder. For example, to build the documentation for version 12.2:

$ git clone [email protected]:iqm-finland/cirq-on-iqm.git
$ cd cirq-on-iqm
$ git checkout 12.2
$ tox run -e docs

tox run -e docs will build the documentation at ./build/sphinx/html. This command requires the tox,, sphinx and sphinx-book-theme Python packages (see the docs optional dependency in pyproject.toml); you can install the necessary packages with pip install -e ".[dev,docs]"

Copyright

Cirq on IQM is free software, released under the Apache License, version 2.0.

Copyright 2020–2024 Cirq on IQM developers.

cirq-on-iqm's People

Contributors

dc914337 avatar freetonik avatar hay-k avatar jkotilahti avatar jmuff22 avatar kukushechkin avatar leonwubben avatar manevala avatar nikosavola avatar olliahonen avatar ollityrkko avatar q-mat-beu avatar rbrazinskas avatar smite avatar spellstaker avatar thaapasa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cirq-on-iqm's Issues

Automated daily tests against latest Cirq version

Since (potentially breaking) changes to Cirq would not automatically test against the code in cirq-on-iqm, we should setup automated tests (using github actions?) in cirq-on-iqm running against the latest version of Cirq to raise an alert whenever there's a breaking change so that it can be detected early on and necessary migrations can be done.

cc @balopat

pip install cirq-iqm fails with python3.9

Steps to reproduce:

$> conda create -n iqm_test python==3.9 
$> conda activate iqm_test
$> pip install cirq-iqm
ERROR: Could not find a version that satisfies the requirement cirq-iqm
ERROR: No matching distribution found for cirq-iqm
Click to expand and view terminal output.

(base) $> conda create -n iqm_test python==3.9 
Collecting package metadata (repodata.json): done
Solving environment: done
## Package Plan ##

  environment location: /Users/tanujkhattar/opt/anaconda3/envs/iqm_test

  added / updated specs:
    - python==3.9


The following NEW packages will be INSTALLED:

  ca-certificates    pkgs/main/osx-64::ca-certificates-2021.4.13-hecd8cb5_1
  certifi            pkgs/main/osx-64::certifi-2020.12.5-py39hecd8cb5_0
  libcxx             pkgs/main/osx-64::libcxx-10.0.0-1
  libffi             pkgs/main/osx-64::libffi-3.3-hb1e8313_2
  ncurses            pkgs/main/osx-64::ncurses-6.2-h0a44026_1
  openssl            pkgs/main/osx-64::openssl-1.1.1k-h9ed2024_0
  pip                pkgs/main/osx-64::pip-21.0.1-py39hecd8cb5_0
  python             pkgs/main/osx-64::python-3.9.0-h88f2d9e_2
  readline           pkgs/main/osx-64::readline-8.1-h9ed2024_0
  setuptools         pkgs/main/osx-64::setuptools-52.0.0-py39hecd8cb5_0
  sqlite             pkgs/main/osx-64::sqlite-3.35.4-hce871da_0
  tk                 pkgs/main/osx-64::tk-8.6.10-hb0a8c7a_0
  tzdata             pkgs/main/noarch::tzdata-2020f-h52ac0ba_0
  wheel              pkgs/main/noarch::wheel-0.36.2-pyhd3eb1b0_0
  xz                 pkgs/main/osx-64::xz-5.2.5-h1de35cc_0
  zlib               pkgs/main/osx-64::zlib-1.2.11-h1de35cc_3


Proceed ([y]/n)? y

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

(base) $> conda activate iqm_test
(iqm_test) $> pip install cirq-iqm
ERROR: Could not find a version that satisfies the requirement cirq-iqm
ERROR: No matching distribution found for cirq-iqm

[Discuss] IsingGate design and implementation

The comment in IsingGate class says that it's needed because cirq.ops.ZZPowGate contains decomposition logic which iqm wants to avoid.

Since the decomposition logic of a gate is mainly called when the code dealing with the gate (eg: Simulator) doesn't understand what the gate is, it's not clear to me how is the default decomposition logic of ZZPowGate in Cirq causing an issue for IQM?

If the problem is that because the hardware natively supports IsingGate and therefore we want to use it as a primitive in cirq circuits, I think it would be better if we implement it by inheriting from cirq.ops.ZZPowGate and passing the global phase as an init parameter. A similar approach is used in Cirq to implement Mølmer–Sørensen Gate by extending cirq.XXPowGate.

Another approach could be to use ZZPowGate in the cirq circuits (for optimisation and simulation) and convert to an appropriate representation (of IsingGate) -- which the hardware understands -- during the serialisation step when the circuit has to be sent to the hardware. For Eg: See Serialiser of IonQ that does something similar.

cc @balopat

Streamline contributor experience / processes

Cirq has a growing community of contributors and it would be nice if the contributor experience and processes of cirq-on-iqm are similar to that of cirq. Some concrete suggestions for changes would be

  • Have a DEVELOPMENT.md highlighting the contribution process.
  • Run tests/coverage checks on PRs via github actions
  • Follow pattern of placing _test.py files next to .py

cc @balopat

Remove the hack of iterating a fixed number of times in simplify_circuit

Fix the current hack of using a fixed number of iterations in simplify_circuit by directly comparing old and new circuit to check whether any optimisation was applied.

The change would look something like this:

while True:
    old_circuit = circuit.copy()
    MergeOneParameterGroupGates().optimize_circuit(circuit)
    optimizers.merge_single_qubit_gates_into_phased_x_z(circuit)
    # all z rotations are pushed past the first two-qubit gate following them
    IQMEjectZ(eject_parameterized=True).optimize_circuit(circuit)
    optimizers.DropEmptyMoments().optimize_circuit(circuit)
    # Circuit has reached a fixed point. 
    if circuit == old_circuit:
        break

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.