Giter Club home page Giter Club logo

quest's Introduction

The QuEST logo

GitHub release Doc unit tests MIT license

The Quantum Exact Simulation Toolkit is a high performance simulator of quantum circuits, state-vectors and density matrices. QuEST uses multithreading, GPU acceleration and distribution to run lightning first on laptops, desktops and networked supercomputers. QuEST just works; it is stand-alone, requires no installation, and is trivial to compile and run. QuEST hybridises OpenMP and MPI with huge compiler support to run on all sorts of multicore, multi-CPU and distributed hardware, uses HIP to run on AMD GPUs, integrates cuQuantum and Thrust for cutting-edge performance on modern NVIDIA GPUs, and has a custom kernel backend to run on older CUDA-compatible GPUs. And it hides these deployment modes behind a single, seamless interface.

Languages Languages OS OS OS Platforms Platforms Platforms Platforms Platforms

QuEST is developed by the QTechTheory group at the University of Oxford, and these authors. To learn more:

DOI Email


🎉  Introduction

QuEST has a simple interface, which is agnostic to its runtime environment, between CPUs, GPUs and over networks.

hadamard(qubits, 0);

controlledRotateX(qubits, 0, 1, angle);

double prob = calcProbOfOutcome(qubits, 0, outcome);

Yet, it is flexible

Vector v;
v.x = 1; v.y = .5; v.z = 0;
rotateAroundAxis(qubits, 0, angle, v);

ComplexMatrix2 u = {
    .real = {{.5, .5}, { .5,.5}},
    .imag = {{.5,-.5}, {-.5,.5}}};
unitary(qubits, 0, u);

mixDepolarising(qubits, 0, prob);

and extremely powerful

ComplexMatrixN u = createComplexMatrixN(5);
int ctrls[] = {0, 1, 2};
int targs[] = {5, 20, 15, 10, 25};
multiControlledMultiQubitUnitary(qubits, ctrls, 3, targs, 5, u);

ComplexMatrixN k1, k2, k3 = ...
mixMultiQubitKrausMap(qubits, targs, 5, {k1, k2, k3}, 3);

double val = calcExpecPauliHamil(qubits, hamiltonian, workspace);

applyTrotterCircuit(qubits, hamiltonian, time, order, repetitions);

✅  Features

QuEST supports:

  • ☑️   density matrices for precise simulation of noisy quantum computers
  • ☑️   general unitaries with any number of control and target qubits
  • ☑️   general decoherence channels of any dimension
  • ☑️   general Hermitian operators in the Pauli basis
  • ☑️   many many operators, including even Pauli gadgets, analytic phase functions and Trotter circuits
  • ☑️   many tools to analyse quantum states, such as calculations of probability, fidelity, and expected value
  • ☑️   variable precision through a qreal numerical type which can use single, double or quad precision
  • ☑️   QASM output to verify simulated circuits
  • ☑️   direct access to amplitudes for rapid custom modification of the quantum state
  • ☑️   native compilation on MacOS, Linux and Windows, through Clang, GNU, Intel, and MSVC compilers

📖  Documentation

For developers: QuEST's doc is automatically regenerated when the master branch is updated via Github Actions. To locally regenerate the doc, run doxygen doxyconfig/config in the root directory, which generates html documentation in Doxygen_doc/html.


🚀  Getting started

To rocket right in, download QuEST with git at the terminal

git clone https://github.com/quest-kit/QuEST.git
cd QuEST

Compile the tutorial example (source) using cmake and make

mkdir build
cd build
cmake ..
make

then run it with

./demo

Windows users should install Build Tools for Visual Studio, and CMake, and run the above commmands in the Developer Command Prompt for VS, though using build commands

cmake .. -G "NMake Makefiles"
nmake

If using MSVC and NMake in this way fails, users can forego GPU acceleration, download MinGW-w64, and compile via

cmake .. -G "MinGW Makefiles"
make

❤️  Acknowledgements

We sincerely thank the following external contributors to QuEST.

QuEST uses the mt19937ar Mersenne Twister algorithm for random number generation, under the BSD licence. QuEST optionally (by additionally importing QuEST_complex.h) integrates the language agnostic complex type by Randy Meyers and Dr. Thomas Plum


📰  Related projects

  • QuESTlink
    a Mathematica package enabling symbolic circuit manipulation, analytic simulation, visualisation and high performance simulation with remote accelerated hardware.

  • pyQuEST
    a python interface to QuEST, based on Cython, developed within the QTechTheory group. Please note, pyQuEST is currently in the alpha stage.

  • PyQuEST-cffi
    a python interface to QuEST based on cffi developed by HQS Quantum Simulations. Please note, PyQuEST-cffi is currently in the alpha stage and not an official QuEST project.

quest's People

Contributors

aniabrown avatar balintkoczor avatar bvillasen avatar chr5tphr avatar drewsilcock avatar fcooper8472 avatar glebx-f avatar kshitijc avatar milos9304 avatar nfwvogt avatar oerc0122 avatar rrmeister avatar tysonrayjones avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

quest's Issues

New feature: Add getter for number of amplitudes in state vector

  • The multiqubit object shouldn't be accessed directly as the properties on that object aren't defined in the API. In particular, number of amplitudes means number of amplitudes per MPI rank in the distributed case, which happens to be total number of amplitudes in the whole system in the local case. It will be safer to access the number of amplitudes from an API function

Code Formatting

It would be great to run some C formatter on the source code, just to make it a bit more uniform, just as in places there is code like

void example(){

}

then something like

void example() {

}

or

void example()
{

}

It would just make the source a little more readable, but thats just my preference!
I will do a pull request, but please fell free to ignore if needed, if you think it's not necessary.

Implement missing density state functions

Currently, these are

  • CPU MPI densmatr_initPureState
  • CPU MPI densmatr_collapseToKnownProbOutcome
  • CPU local densmatr_collapseToKnownProbOutcome

the density analogs of the debugging functions (if necessary)

  • initStateDebug
  • initStateFromSingleFile
  • initStateOfSingleQubit
  • reportStateToScreen

Remove code duplication in OMP parallelism

These lines:

sizeHalfBlock = 1LL << targetQubit;  
sizeBlock     = 2LL * sizeHalfBlock; 

and

        thisBlock   = thisTask / sizeHalfBlock;
        indexUp     = thisBlock*sizeBlock + thisTask%sizeHalfBlock;
        indexLo     = indexUp + sizeHalfBlock;

are duplicated in almost every *Local function in QuEST_cpu.c.
Should they instead be fetched by something like

getStateVecIndices(targetQubit, thisTask, &indexUp, &indexLo)

Add new density matrix functions

  • to add two probability-weighted density matrices (or one pure)
  • explicit trace function (currently calcTotalProbability)
  • trace of density matrix squared
  • fidelity

New feature, documentation: Add developer guide

  • While internal functions are documented using doxygen, it would be useful to have a higher level description of how the code works, particularly how MPI/non-mpi functionality is handled, for developers

Rename QubitRegister numQubits field

Since this is the number of qubits suggested by the dimensions of the state-vector, which is twice too many when the register is storing a density matrix (and should instead refer to numDensityQubits).

Consider renaming

  • numDensityQubits -> numQubitsRepresented
  • numQubits -> numQubitsInStateVec

Still seems hacky and gross ¯\(ツ)

New feature: Add error model to MultiQubit object

  • Update the MultiQubit object or add a new MultiQubitWithErrors object that contains information about errors that should be introduced during each operation on the qubit
  • Could be a small error with every operation or a probability of a larger error with each operation

New feature: initStateFromAmps

Lets the user supply amplitudes to set in the (possibly distributed) state-vector.
Something like
initStateByAmps(reg, reals, imags, numAmps, startInd)
would allow writing chunks at a time, needed when distributed.

Rename some functions

  • getRealAmpEl
  • getImagAmpEl
  • getProbEl

Also, should exist getAmplitude which returns Complex for state-vectors.

  • initStatePlus -> initPlusState
  • initStateZero -> initZeroState
    brings them more in-line with initClassicalState and initPureState.
    Is init the best prefix?

Unit test density matrix operations

  • regular gates (very tedious though - particular attention to measurements)
  • calcFidelity
  • calcPurity
  • calcTotalProbability
  • oneQubitDephase
  • twoQubitDephase
  • oneQubitDepolarise
  • twoQubitDepolarise
  • combineDensityMatrices
  • getDensityAmplitude

New feature: add setters for elements in the state vector

  • While the state vector of probability amplitudes wouldn't be updated in usual use, we have seen cases where the user extends the code by updating this vector directly. This code might break if the program was switched from running locally to running across multiple nodes, so it is safer to offer setters which can handle distributed mode in the API

make createQubitRegister and initQuESTEnv return dynamic memory?

Why should we make the user supply a reference to the struct in the stack, when the create... and init... funcitons could just as easily malloc space for the struct in the heap and return that?
We already require explicit freeing functions to free their dynamic attribs.

This would mean the creation of these structs is in one line...

QubitRegister* qureg = createQubitRegister(5);

as opposed to

QubitRegister qureg;
createQubitRegister(&qureg, 5);

It also means the users naturally have a handle to a pointer rather than the struct - all gate functions could then consistently accept a pointer (to be negligably more efficient by not having to copy the struct fields).
E.g. we currently do

QubitRegister qureg;
createQubitRegister(&qureg, 5);
initStateZero(qureg);

but could instead do

QubitRegister* qureg = createQubitRegister(5);
initStateZero(qureg);

where initStateZero now accepts a pointer.

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.