**Development of fast CPU and GPU based quantum computer simulator for Cirq**

We now see the word ‘quantum’ every day in news articles and blog posts, partly because of the announcement from Google that they achieved quantum supremacy.

It means no other computers can predict how Google’s Sycamore chip behaves. It means, on the other hand, other quantum computers can be simulated with a classical computer.

What Google has achieved is a milestone in the field of quantum computation as a first step to solve practical problems faster than a supercomputer. The next milestone is quantum speedup — beating a supercomputer for practical purposes. To realize it, we need not only good hardware but also algorithms that make the most out of the quantum computer.

Towards this achievement, we — QunaSys focus on algorithm development. A quantum computer simulator is an essential tool for our algorithm research. (See our algorithms developed so far: https://en.qunasys.com/publications)

We extended Cirq to support our simulator Qulacs. This article is about the project of Cirq — Qulacs (https://github.com/qulacs/cirq-qulacs) development.

**Why do we need a fast quantum computer simulator?**

With quantum supremacy demonstrated, you might think that we don’t need a simulator anymore. We just need to ask Google to let us use their supremacy proven chip!

However, in fact, most researchers won’t use real quantum devices for algorithm development, in particular for the proof-of-concept initial validation because of the current quantum computers called NISQ (Noisy Intermediate-Scale Quantum Computer) are ‘noisy’.

Suppose that you come up with a new algorithm and use a real quantum computing device to test it. If it doesn’t work as you expected — that happens very often, it would be hard to know whether it was due to the hardware or not, considering the fidelity upper bound inherent to the NISQ devices.

Our simulator can simulate only up to 36 qubit algorithms, but it is still an ideal environment for algorithm development because it’s not affected by any external noise.

**About Qulacs**

Simulating quantum computers is exponentially difficult. If you want to simulate one more qubit, it will require x2 memory and x2 calculation time. It means that simulating 20 qubits will need about 1,000 times more memory and 1,000 times more time compared to 10 qubits.

Speed is essential, especially for running a variational algorithm which is thought to be a prominent application for NISQ. Variational algorithms need many iteration processes, and calculating a gradient of parametric quantum circuits needs a lot of circuit evaluations.

Qulacs (https://github.com/qulacs/qulacs) is a fast quantum computer simulator originally developed by our advisor Keisuke Fujii’s group (http://quantphys.org/wp/keisukefujii_eng/). The core simulation program is written in C/C++ associated with a lightweight python interface. With this combination, we fulfilled the speed and usability requirements at once.

With Qulacs, we succeeded in simulating up to a 24qubit quantum system for Variational Quantum Eigensolver (VQE) algorithm. We also have launched a website comparing VQE based algorithms where we used Qulacs for all benchmarks (https://quantaggle.com/).

**Development of Cirq — Qulacs**

Google has developed an open-source quantum computer library, Cirq, that will be a standard interface to use Google’s quantum computing system. Cirq has a CPU based quantum computer simulator.

We got benchmark results indicating that GPU based simulation could be up to 1,000 times faster than CPU based simulators — it was good news; we can significantly speed-up Cirq’s simulator by using our Qulacs simulator, which supports CPUs and GPUs as a backend. For that purpose, we developed the Cirq interface to integrate Qulacs as an additional simulator. (https://github.com/qulacs/cirq-qulacs).

With this effort, we succeeded to run Cirq’s quantum circuits simulation at least x50 faster in all qubits and up to x500 in large qubit using GPU.

**How to use:**

Once you installed Cirq and have developed a quantum algorithm written in Cirq, the next step is to install Qulacs and Cirq-Qulacs. After installing these libraries, all you have to do is just replace cirq.simulator() with QulacsSimulator() for CPU implementation and QulacsSimulatorGpu() for GPU implementation.

Please see the demo in Google Colaboratory.

**Further step — contribution welcome!!**

The following is our development plan.

・Parallelization of gradient evaluation

The convergence of variational algorithms will be faster if you evaluate the gradient of the parametric quantum circuit. However, you need to simulate the circuit once for every parameter in the circuit, which leads to the total computation time scaling linearly to the number of parameters in the circuit. We expect it will be faster to run variational algorithms with parallelized circuit simulation using a multi-CPU or multi-GPU device.

**Acknowledgment**

For this project, we received a lot of advice from the Google AI Quantum team.

Thank you so much for the helpful feedback!

Also we appreciate the pleasant comment from Dr. Markus Hoffmann (Google Quantum Computing Partnerships) for this project!

“*It’s great to see the strong QunaSys team collaborate with top academics in the field to extend the offering of fast quantum simulators supported by Cirq.”*

**We are hiring! & Welcoming interns!**

QunaSys is a quantum computing startup based in Japan. We have a strong research team that published many industrially significant algorithms (see our paper here: https://en.qunasys.com/publications) and a strong engineering team making NISQ algorithm library for quantum chemistry.

We are hiring and welcoming interns of quantum computing engineers.

Jobs will be: Implementing and taking benchmarks of quantum algorithms in research papers. Make demos of industrial necessary problems by combining several NISQ algorithms.