infleqtion / client-superstaq Goto Github PK
View Code? Open in Web Editor NEWhttps://superstaq.readthedocs.io
License: Apache License 2.0
https://superstaq.readthedocs.io
License: Apache License 2.0
What about putting in one line?
out_qasm_str = """OPENQASM 2.0;
include "qelib1.inc";
Qubits: [4, 5]
qreg q[2];
cz q[0],q[1];"""
Originally posted by @vtomole in https://github.com/SupertechLabs/qiskit-superstaq/pull/25#discussion_r696067183
import qiskit
import qiskit_superstaq
provider = qiskit_superstaq.superstaq_provider.SuperstaQProvider("token")
circuit1 = qiskit.QuantumCircuit(8)
for i in range(4, 8):
circuit1.h(i)
circuit1.draw(fold=-1)
compiler_output = provider.aqt_compile(circuit1)
Throws HTTPError: 400 Client Error: BAD REQUEST for url: https://superstaq.super.tech/v0.1.0/aqt_compile
Similar to cirq_superstaq.Service.__init__()
. Link
pytest passes with applications-superstaq==0.0.2 but not 0.0.3
This is because in applications_superstaq==0.0.3 the following output dataclasses were updated to require a qubo
element:
finance.MinVolOutput
finance.MaxSharpeOutput
logistics.TSPOutput
logistics.WarehouseOutput
Fix could be either to pass qubo
arguments in service_test.py, or make these elements optional in applications-superstaq. Either way requirements.txt should probably specify the version of applications-superstaq
@singular-value yeah I'd just set it up to catch ModuleNotFoundError
s and throw something else - will add it now
Originally posted by @richrines1 in https://github.com/SupertechLabs/cirq-superstaq/issues/50#issuecomment-912671484
In https://github.com/SupertechLabs/cirq-superstaq/blob/main/examples/aqt_compile.ipynb, there are no default yaml configs, so if user doesn't provide configs there's an error:
E.g., in service.py
we use target
:
https://github.com/SupertechLabs/cirq-superstaq/blob/1af069ad78f030d6887cd0e8d585f1cad49bd1f3/cirq_superstaq/service.py#L260-L262
while in superstaq_client.py
we use backend
:
More of a nit, and I've mostly seen target
when used as a parameter or keyword, but as @richrines1 pointed out it's probably a good idea to standardize our language on it, at least moving forward.
See #117
Specifically, an error is being thrown here in superstaq_backend.py
:
if "ids" not in response: raise Exception
Failing because TSP route is A->D->C->B->A instead of A->B->C->D->A. Both are valid (up to traffic of the day).
https://github.com/SupertechLabs/cirq-superstaq/actions/runs/1354988574
https://github.com/SupertechLabs/cirq-superstaq/actions/runs/1300641118
Even after fixing server
Signpost for the user
import qiskit_superstaq
token = """token"""
superstaq = qiskit_superstaq.superstaq_provider.SuperstaQProvider(token)
backend = superstaq.get_backend("rigetti_aspen")
print(backend.configuration().n_qubits) # should print 32, but it prints -1 instead
Need docs for accessing qiskit-superstaq
/ an example tutorial for creating and submitting a circuit through qiskit-superstaq
.
and eventually a similar one in qiskit-superstaq (but not now)
import cirq_superstaq
cirq_superstaq.__version__
throws
AttributeError: module 'cirq_superstaq' has no attribute '__version__'
Reason for this https://stackoverflow.com/a/46860500/5716192.
Basically, qiskit_superstaq hasn't earned the right popularity wise like numpy and pandas to use as qss
yet.
cirq-superstaq uses the SUPERSTAQ_API_KEY
environment variable (if set), while
qiskit-superstaq does not. We should use it. That way, testing qiskit-superstaq locally does not require passing in a token directly. Proposed by @singular-value.
currently ibmq_token
, ibmq_group
, self.ibmq_hub
, and ibmq_project
get sent to the server even when their value is None
. they should be excluded from the json_dict
in superstaq_client.create_job()
unless they're given a value
Also for qiskit-superstaq maybe
qubovert==1.2.3
should be qubovert>=1.2.3
as in cirq_superstaqnumpy
requirement should be less specific. Currently cirq requires numpy~=1.16
and qiskit requires numpy>=1.17
- do we need 1.20?Talk to @vtomole
I forgot to update examples/qiskit_example.py
in the multiple circuit submission push. Add something like
job = backend.run([qc1,qc2], shots=100)
print(job.result().get_counts(1))
especially with a lot of circuits or pulse sequence data, the repr()
string of AQTCompilerOutput
gets pretty unweildy when it's displayed in an ipython console or jupyter notbook. _repr_pretty_()
would add an abbreviated/human-readable display representation to be used by ipython/jupyter. This is what's done by cirq.Circuit
, for example
(probably applies to other classes in *_superstaq as well)
Add guiding comments for the user to understand what each line of code does. Similar to qiskit-example-multiple-circuits
branch in qiskit-superstaq.
Internal Server errors are serious. We should fail at the sight of them instead of retrying.
Deleting https://github.com/SupertechLabs/cirq-superstaq/blob/1f67d5ee2f904455a0c01308a669395cff1ce95e/cirq_superstaq/superstaq_client.py#L35 should do it.
Right now, we convert qiskit circuits to cirq circuits just so that we can call cirq.to_json(circuit)
and get a JSON-serialized version. But then on the server, we go back down to the qiskit circuit anyways.
There should be a way to get qiskit circuits down to a serialized format; there shouldn't be a need for a cirq dependency.
repr(qc)
doesn't work, but maybe just taking the qc.qasm()
would work.
From /jobs to /job
cirq-superstaq uses the SUPERSTAQ_REMOTE_HOST environment variable (if set), while
qiskit-superstaq does not. We should use it. That way, testing qiskit-superstaq locally does not require changing qss.API_URL. Proposed by @singular-value.
(Migrating issue from SuperstaQ)
InsecureRequestWarning: Unverified HTTPS request is being made to host '127.0.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings
warnings.warn(
Likely to do with the need to set verify = False
somewhere.
Support run-batch (connect to multi_job server endpoint) along with this.
When running the aqt-compile
demo, getting InsecureRequest warning from https://github.com/SupertechLabs/SuperstaQ/issues/520. Errors do not show up when running locally in cirq-superstaq
repo.
For temporary fix, add the following:
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
import qiskit_superstaq
token = """token"""
superstaq = qiskit_superstaq.superstaq_provider.SuperstaQProvider(token)
backend = superstaq.get_backend("rigetti_aspen")
print(backend.configuration().max_experiments) # Raises an `AttributeError: Attribute max_experiments is not defined` error
Server will warn when endpoint is deprecated (https://flask-deprecate.readthedocs.io/en/latest/flask_deprecate.html#flask_deprecate.flask_deprecate.deprecate_route)
Server will warn when endpoint is deprecated (https://flask-deprecate.readthedocs.io/en/latest/flask_deprecate.html#flask_deprecate.flask_deprecate.deprecate_route)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.