How to use IonQ/Rigetti Device on blueqat cloud
Hello recently quantum computing is on the great demand. I will introduce the simplest way to use IonQ or Rigetti machine on our blueqat cloud.
1.You need API credit
Paid users are monthly fulfilled with API credit. Other free users need blueqat credit to use quantum computers. On the jupyternotebook you can use blueqat cloud and SDK for free, but once you want to use IonQ or Rigetti device, you need API credit.
API credit is available here.
the credit is 0.032JPY/credit and you need 50 credits for IonQ or 2 credits for Rigetti to use.
You can check your API credit and API key from the setting menu on the right up of the page.
2.blueqat cloud python library to use IonQ/Rigetti
We have original APIs to post tasks to these machines.
or you can just use blueqat cloud for free. This library is pre-installed.
3.Register the API key
After log in to the jupyter notebook of blueqat cloud, first, you need to register your API key to the cloud server. It will be stored as a file, so you need this operation just once at the beginning.
from bqcloud import register_api api = register_api("enter your API key here")
4.Load the API key and start coding on quantum computer
Once you finish registering your API key to the server, you can access to the quantum computer with your credits. By using load_api you can start using it.
from bqcloud import load_api api = load_api()
5.Let's use IonQ or Rigetti
At the moment you can use IonQ(11qubits) or Rigetti Aspen11(38qubits). To post the circuit to the machine is easy. Just write the circuit without measurement and execute it.
from blueqat import Circuit from bqcloud import Device # Circuit, Device, Number of shots, Group name(Optional) for IonQ task = api.execute(Circuit().h.cx[0, 1], Device.IonQDevice, 10, "hello-world") # Circuit, Device, Number of shots, Group name(Optional) for Rigetti task = api.execute(Circuit().h.cx[0, 1], Device.Aspen11, 10, "hello-world")
6.Look at the status or update task
After you post your task you can check your status or update the status like below.
7.Wait and get the result
The machines at the moment is not enough over the world. We have to wait until the machine work and the tasks finished. Usually it takes time.
Weekdays, 13:00:00 - 02:00:00 UTC
Everyday, 15:00:00 - 19:00:00 UTC
# Wait 10 sec. If complete, result is returned, otherwise, None is returned. result = task.wait(timeout=10) if result: print(result.shots()) else: print("timeout")
Once the task finished you can get the result.
8.Get fetched result again
You can get the result again
# Once updated or waited after task completed, task.result() returns the result. result = task.result() if result: print(result.shots()) else: print("result is not fetched")
And get the list of tasks
tasks = api.tasks() print(list(tasks)) if tasks.result() is not None: print(tasks.result().shots())
We simply introduce our blueqat cloud. At the moment we recommend to use these two machines among many. In near future we will add some new machines. Thank you for reading the article and enjoy working on quantum computing.