GithubHelp home page GithubHelp logo

olivas / tket Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cqcl/tket

0.0 0.0 0.0 1.3 GB

Source code for the TKET quantum compiler, Python bindings and utilities

Home Page: https://tket.quantinuum.com/

License: Apache License 2.0

Shell 0.01% JavaScript 0.01% C++ 69.15% Python 29.37% C 0.04% Rust 0.02% Nix 0.10% Makefile 0.01% HTML 0.02% CMake 0.79% OpenQASM 0.49%

tket's Introduction

tket

Slack Stack Exchange PyPI version

Introduction

TKET (pronounced "ticket") is a high-performance quantum compiler that can optimise circuits for a wide range of quantum computing architectures.

This repository contains the full source code for TKET and its python bindings.

The standard way of using TKET is via its pytket python API.

If you just want to use TKET via Python, the easiest way is to install pytket with pip:

pip install pytket

As well as being an interface to the TKET compiler, pytket also provides an extensive API for other quantum computing tasks. These include constructing quantum circuits and handling the execution of experiments on devices and simulators.

Documentation

The tket (C++) API documentation (generated with doxygen, and still rather patchy) is available here.

The pytket (Python) API documentation is available here.

For getting started using pytket, check out the user manual and notebook examples.

The source content for the manual and notebook examples can be found in the pytket-docs repository.

Extensions

In addition to the core pytket package there are pytket extension modules which allow pytket to interface with quantum devices and simulators. Some extensions also provide interoperability with other software libraries such as qiskit, cirq and pennylane.

For a list of available pytket extensions see the extensions index page.

These extensions are installed as separate python packages and the source code for each extension lives in its own github repository.

How to build TKET and pytket

If you would like to build TKET yourself and help to improve it, read on!

The codebase is split into two main projects:

  • tket: the core functionality of tket, optimised for execution speed and implemented in C++.
  • pytket: the Python interface of tket. This consists of binder modules to tket (written in C++ and making use of pybind11 to link to the tket shared library) and pure Python code that defines abstract interfaces used by the extension modules such as the Backend and BackendResult classes, as well as various other utilities.

Prerequisites

Build tools

The following compiler toolchains are used to build tket on the CI and are therefore known to work:

  • Linux: gcc-11
  • MacOS: apple-clang 14
  • Windows: MSVC 19

It is recommended that you use these versions to build locally, as code may depend on the features they support. The compiler version can be controlled by setting CC and CXX in your environment (e.g. CC=gcc-11 and CXX=g++-11), or on Debian-based Linux systems using update-alternatives.

You should also have Python (3.10, 3.11 or 3.12) and pip installed. We use cmake and the package manager conan to build tket and pytket. The latter can be installed with pip:

pip install conan

You will need at least cmake version 3.26, and conan version 2.

Set up conan profile

Generate a profile that matches your current machine, and add the required remote where some dependencies are stored:

conan profile detect
conan remote add tket-libs https://quantinuumsw.jfrog.io/artifactory/api/conan/tket1-libs --index 0

Optional: use ninja and ccache

It is recommended that you also install ninja and ccache to speed up the build process. For example with apt on Debian/Ubuntu:

apt install ninja-build ccache

Homebrew on MacOS/Linux:

brew install ninja ccache

Chocolatey on Windows:

choco install ninja ccache

On MacOS/Linux:

  • If installed, ccache is used automatically
  • ninja must either be set as the default Cmake generator using the following command:
    echo "tools.cmake.cmaketoolchain:generator = Ninja" >> $(conan config home)/global.conf
    or be specified on a command-by-command basis by providing the argument -c tools.cmake.cmaketoolchain:generator=Ninja to conan

On Windows:

  • Set ninja as generator as described above (less reliable than the default Visual Studio generator)
  • ccache will be used automatically only when using Ninja or Makefile as the Cmake generator. It can also be used with Visual Studio generators by setting the environment variable TKET_VSGEN_CCACHE_EXE to the path of the ccache executable. Note: this must be the path to the actual binary, not a symlink or shim (as used by Chocolatey). If using Chocolatey to install ccache, you can find the path to the binary using ccache --shimgen-help

Building and testing the utility libraries

See the README in the libs directory for instructions on building and testing the utility libraries used by tket (for logging, random-number generation and so on). This is not necessary if you just want to build tket or pytket since the recipes or binaries will be automatically downloaded from the above conan remote.

Building and testing the tket library

See the README in the tket directory for instructions on building and testing tket as a standalone C++ library.

Building and testing pytket

See the README in the pytket directory for instructions on building and testing pytket.

Nix Support

Tket and pytket are available as a Nix flake, with support for Linux and Apple Silicon systems. See the README in the nix-support directory for instructions on building and testing tket and pytket through Nix, and on how to use it within a Nix project.

tket's People

Contributors

cqc-alec avatar yao-cqc avatar cqc-melf avatar sjdilkes avatar calmaccq avatar lmondada avatar aborgna-q avatar trvto avatar dependabot[bot] avatar willsimmons1465 avatar ss2165 avatar dna386 avatar roland-djee avatar ferbetanzo avatar drzenharper avatar jake-arkinstall avatar alexcowtan avatar dlyongemallo avatar domnomnom avatar srulre avatar johnchildren avatar qartik avatar monitsharma avatar 1tnguyen avatar vtomole avatar aidancq avatar andrew-tranter avatar jake-arkinstall-quantinuum avatar

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.