TransWikia.com

Running Google Cirq example code from their webpage -- where do I find information about PROCESSOR_ID?

Quantum Computing Asked by cere on July 14, 2021

I’m just ttrying to run the simple example code in Google’s Cirq startup page:
https://cirq.readthedocs.io/en/stable/google/engine.html

I think I have the access authorized correctly via Google’s Console, but can someone help me understand where I would find the information for the PROCESSOR_ID? Thanks.

Code cut/paste from their webpage here:

import cirq
import cirq.google as cg

# A simple sample circuit
qubit = cirq.GridQubit(5, 2)
circuit = cirq.Circuit(
    cirq.X(qubit)**0.5,                 # Square root of NOT.
    cirq.measure(qubit, key='result')   # Measurement.
)

# Create an Engine object to use.
# Replace YOUR_PROJECT_ID with the id from your cloud project.
engine = cg.Engine(project_id=YOUR_PROJECT_ID, proto_version=cg.ProtoVersion.V2)

# Create a sampler from the engine
sampler = engine.sampler(processor_id='PROCESSOR_ID', gate_set=cg.SYC_GATESET)

# This will run the circuit and return the results in a 'TrialResult'
results = sampler.run(circuit, repetitions=1000)

# Sampler results can be accessed several ways

# For instance, to see the histogram of results
print(results.histogram(key='result'))

# Or the data itself
print(results.data)

2 Answers

Do you have access specifically given by Google? See the second paragraph in the link you sent:

Note that the Quantum Engine API is not yet open for public access.

Likely their chips are only being used for internal testing now, and the docs are being prepped for public release / public chip access.

Answered by C. Kang on July 14, 2021

There is a method list_processors on the engine object that will return a list of processor objects which include a processor id:

for p in engine.list_processors():
    print(p.processor_id)

That being said, as mentioned in the cirq docs you linked, Google's quantum computing service isn't publicly available yet. So the most likely result of running that code is an access error, or an empty list (meaning you have access to no processors). If you want to watch someone using the service (plus some neat hardware build stuff) you can watch the second half of the "Google's Quantum Computing Service" presentation at the 2020 quantum summer symposium.

Answered by Craig Gidney on July 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP