qiskit / qiskit-ibm-runtime Goto Github PK
View Code? Open in Web Editor NEWIBM Client for Qiskit Runtime
Home Page: https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
License: Apache License 2.0
IBM Client for Qiskit Runtime
Home Page: https://docs.quantum.ibm.com/api/qiskit-ibm-runtime
License: Apache License 2.0
Describe the bug
When running the code from this tutorial : https://qiskit.org/documentation/optimization/tutorials/12_qaoa_runtime.html, when setting the backend to a real one, I have a QiskitError : TensoredMeasFitter doesn't support subset_fitter when setting measurement_error_mitigation=True
, and a PulseError : "Operation 'cx' exists, but is only defined for qubits [(0, 1), (1, 0), (1, 2), (1, 3), (2, 1), (3, 1), (3, 4), (4, 3)]." when use_pulse_efficient=True
Steps to reproduce
from qiskit import IBMQ
provider = IBMQ.load_account()
import numpy as np
from qiskit.opflow import PauliSumOp, Z, I
from qiskit.algorithms.optimizers import SPSA
program_id = "qaoa"
# Define the cost operator to run.
op = (
(Z ^ Z ^ I ^ I ^ I)
- (I ^ I ^ Z ^ Z ^ I)
+ (I ^ I ^ Z ^ I ^ Z)
- (Z ^ I ^ Z ^ I ^ I)
- (I ^ Z ^ Z ^ I ^ I)
+ (I ^ Z ^ I ^ Z ^ I)
+ (I ^ I ^ I ^ Z ^ Z)
)
# SPSA helps deal with noisy environments.
optimizer = SPSA(maxiter=100)
# We will run a depth two QAOA.
reps = 2
# The initial point for the optimization, chosen at random.
initial_point = np.random.random(2 * reps)
# The backend that will run the programm.
#options = {"backend_name": "ibm_perth"}
options = {"backend_name": "ibmq_belem"}
# The inputs of the program as described above.
runtime_inputs = {
"operator": op,
"reps": reps,
"optimizer": optimizer,
"initial_point": initial_point,
"shots": 2 ** 13,
# Set to True when running on real backends to reduce circuit
"measurement_error_mitigation": True,
# depth by leveraging swap strategies. If False the
# given optimization_level (default is 1) will be used.
"use_swap_strategies": False,
# Set to True when optimizing sparse problems.
"use_initial_mapping": False,
# Set to true when using echoed-cross-resonance hardware.
"use_pulse_efficient": False,
}
job = provider.runtime.run(
program_id=program_id,
options=options,
inputs=runtime_inputs,
)
result = job.result()
A user will need to be able to get backend information.
What is the expected feature or enhancement?
A user should be able to login using their IBM Cloud API Key.
class IBMRuntimeService(RuntimeService):
def __init__(self, auth=None, token=None, locator=None):
"""Initialize a new client to use the runtime service.
Args:
auth: Authentication type. `cloud` or `legacy`. If not specified, the saved default is used.
If there is no default value, and both accounts were saved on disk, the cloud type is used.
token: Token used for authentication. If not specified, the saved token is used.
locator: The authentication url, if `auth=legacy`. Otherwise the CRN.
"""
pass
When the user does
service = IBMRuntimeService(token="<apikey>", locator=<CRN>)
no API calls would be made but the passed in values should be stored in the RuntimeClient.
And then for subsequent calls made to the API like service.programs()
or service.pprint_programs()
the
Service-CRN: <paste-CRN-here>
and Authorization: apikey <paste-apikey-here>
headers should be sent with every request.
The URL for production vs staging should be automatically determined based on the cname in the CRN. staging
for staging vs bluemix
for prod.
Example curl to get programs:
curl --location --request GET 'https://us-east.quantum-computing.cloud.ibm.com/programs' --header 'Service-CRN: <paste-CRN-here>' --header 'Authorization: apikey <paste-API-key-here>'
Ported from Qiskit/qiskit-ibm-provider#192.
Users should be able to specify the logging level of a specific runtime execution instance when running a program. logging_level
query parameter is being added to POST /jobs
. Possible values for logging_level: critical, error, warning, info, debug, CRITICAL, ERROR, WARNING, INFO, DEBUG. Default is warning/WARNING.
Problem
@jyu00 noticed that the jupyter
and visualization
modules within qiskit_ibm_runtime
may not work. Prior to the first release (Runtime 0.1) we need to ensure they are functional, or are not referenced in the public documentation.
Acceptance criteria
A user should be able to login using either IBM Cloud API key or IQX API token, save account, view saved account, view active account and also delete saved account for runtime 0.1 release.
class IBMRuntimeService(RuntimeService):
def __init__(self, auth=None, token=None, locator=None):
"""Initialize a new client to use the runtime service.
Args:
auth: Authentication type. `cloud` or `legacy`. If not specified, the saved default is used.
If there is no default value, and both accounts were saved on disk, the cloud type is used.
token: Token used for authentication. If not specified, the saved token is used.
locator: The authentication url, if `auth=legacy`. Otherwise the CRN.
"""
pass
@staticmethod
def delete_account(auth=None) -> None:
"""Delete account information on disk.
Args:
auth: Authentication type. `cloud` or `legacy`. If auth is not passed and if there is one account saved, that is
deleted. If auth is not passed and if there are two accounts saved then `cloud` is deleted first.
"""
pass
@staticmethod
def save_account(token, locator, as_default) -> None:
"""Save account information on disk."""
pass
@staticmethod
def saved_account() -> None:
"""Get saved account information on disk."""
pass
def active_account() -> None:
"""Get account currently in use for the session."""
pass
def logout(self) -> None:
"""Clears authorization cache on the server.
For better performance, the runtime server caches each user's
authorization information. This method is used to force the server
to clear its cache.
Note:
Invoke this method ONLY when your access level to the runtime
service has changed - for example, the first time your account is
given the authority to upload a program.
"""
As explained in the internal design document, create a skeleton for all functions defined in IBMRuntimeService.
What is the expected feature or enhancement?
As per the current approved design, we can pass IBM Cloud API Key (token) and CRN (locator) parameters to authenticate.
Since the CRN is long and not easy to remember, we could also provide another option for the user to specify the human readable service instance name in the locator
parameter.
For example:
service = IBMRuntimeService(token=<token>, locator="Quantum Services-og")
Suggested Solution:
curl -X POST 'https://iam.test.cloud.ibm.com/identity/token' -H 'Content-Type: application/x-www-form-urlencoded' -d 'grant_type=urn:ibm:params:oauth:grant-type:apikey&apikey=<api_key>'
curl -X GET "https://resource-controller.test.cloud.ibm.com/v2/resource_instances?name=Quantum%20Services-og" -H "Authorization: Bearer <access_token>"
Then read the CRN from the resource data returned which looks like below, to make further calls to other runtime APIs.
{
"rows_count": 1,
"next_url": null,
"resources": [
{
"id": "crn:v1:staging:public:quantum-computing:us-east:a/78d9efd23fdb4894837f663626efb044:7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2::",
"guid": "7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2",
"url": "/v2/resource_instances/7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2",
"created_at": "2021-10-25T20:58:21.141685368Z",
"updated_at": "2021-10-25T20:58:22.668667668Z",
"deleted_at": null,
"created_by": "IBMid-55000AJFHA",
"updated_by": "",
"deleted_by": "",
"scheduled_reclaim_at": null,
"restored_at": null,
"scheduled_reclaim_by": "",
"restored_by": "",
"name": "Quantum Services-og",
"region_id": "us-east",
"account_id": "78d9efd23fdb4894837f663626efb044",
"reseller_channel_id": "",
"resource_plan_id": "88f4f591-8b8f-4fc7-94ba-7328d5027508",
"resource_group_id": "c365e8f9d4114785b805b96aeb6962c7",
"resource_group_crn": "crn:v1:staging:public:resource-controller::a/78d9efd23fdb4894837f663626efb044::resource-group:c365e8f9d4114785b805b96aeb6962c7",
"target_crn": "crn:v1:staging:public:globalcatalog::::deployment:88f4f591-8b8f-4fc7-94ba-7328d5027508%3Aus-east95730",
"allow_cleanup": false,
"crn": "crn:v1:staging:public:quantum-computing:us-east:a/78d9efd23fdb4894837f663626efb044:7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2::",
"state": "active",
"type": "service_instance",
"resource_id": "b6049020-80f4-11eb-a0f7-e35ec9b4054f",
"dashboard_url": "http://test.cloud.ibm.com/qc-service-details",
"last_operation": {
"type": "create",
"state": "succeeded",
"async": false,
"description": "Completed create instance operation"
},
"resource_aliases_url": "/v2/resource_instances/7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2/resource_aliases",
"resource_bindings_url": "/v2/resource_instances/7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2/resource_bindings",
"resource_keys_url": "/v2/resource_instances/7d4e1dd0-b3e1-415b-b601-5fc8b38dd8b2/resource_keys",
"plan_history": [
{
"resource_plan_id": "88f4f591-8b8f-4fc7-94ba-7328d5027508",
"start_date": "2021-10-25T20:58:21.141685368Z",
"requestor_id": "IBMid-55000AJFHA"
}
],
"migrated": false,
"controlled_by": "",
"locked": false
}
]
}
I don't like this solution since it makes 2 additional API calls, but it is up to the user to choose this method and sacrifice speed for convenience.
Note: We can throw a warning asking user to use CRN when multiple service instances with the same name are returned.
What is the expected feature or enhancement?
IBMRuntimeService
constructor has a **kwargs
which is documented as
**kwargs: Additional settings for the connection:
* proxies (dict): proxy configuration.
* verify (bool): verify the server's TLS certificate.
If proxies
and verify
are the only ones allowed, why not spell them out?
Aggregate bugs and tasks related to repo setup, continuous integration and other technical tasks required for runtime 0.1 release.
What is the expected feature or enhancement?
Currently there is a set of tutorials and program source code living in https://github.com/Qiskit-Partners/qiskit-runtime. It was created because qiskit-ibmq-provider
had non-runtime services. But since this repo is only about runtime, it doesn't make sense to have 2 repos.
Acceptance criteria
qiskit-runtime
is merged into qiskit-ibm-runtime
.
Describe the bug
VQEProgram fails when using ansatz = EfficientSU2() that does not have any parameter.
This specific ansatz works well in classical VQE (i guess some parameter values are used by default when none is specified)
Error stack message:
Traceback (most recent call last):
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\runtime\vqe_program.py", line 282, in compute_minimum_eigenvalue
result = job.result()
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit\providers\ibmq\runtime\runtime_job.py", line 151, in result
raise RuntimeJobFailureError(f"Unable to retrieve job result. "
qiskit.providers.ibmq.runtime.exceptions.RuntimeJobFailureError: 'Unable to retrieve job result. Job c6kd626gkavn0ge25jng has failed:\n2021-12-02T14:08:52.305396155Z Traceback (most recent call last):\n2021-12-02T14:08:52.305396155Z File "/code/program_starter.py", line 61, in <module>\n2021-12-02T14:08:52.305396155Z user_params = json.loads(params, cls=RuntimeDecoder)\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads\n2021-12-02T14:08:52.305396155Z return cls(**kw).decode(s)\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode\n2021-12-02T14:08:52.305396155Z obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode\n2021-12-02T14:08:52.305396155Z obj, end = self.scan_once(s, idx)\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 229, in object_hook\n2021-12-02T14:08:52.305396155Z return _decode_and_deserialize(obj_val, qpy_serialization.load)[0]\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 87, in _decode_and_deserialize\n2021-12-02T14:08:52.305396155Z orig = deserializer(buff)\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1053, in load\n2021-12-02T14:08:52.305396155Z circuits.append(_read_circuit(file_obj))\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1154, in _read_circuit\n2021-12-02T14:08:52.305396155Z circ = QuantumCircuit(\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/quantumcircuit.py", line 195, in __init__\n2021-12-02T14:08:52.305396155Z self.add_register(*regs)\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/quantumcircuit.py", line 1167, in add_register\n2021-12-02T14:08:52.305396155Z regs = (QuantumRegister(regs[0], "q"), ClassicalRegister(regs[1], "c"))\n2021-12-02T14:08:52.305396155Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/register.py", line 86, in __init__\n2021-12-02T14:08:52.305396155Z raise CircuitError(\n2021-12-02T14:08:52.305396155Z qiskit.circuit.exceptions.CircuitError: "Register size must be positive (int \'0\' was provided)"\n'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File ".\minimal_example - vqeclient gss.py", line 64, in <module>
result = ground_state_solver.solve(problem=problem)
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\algorithms\ground_state_solvers\ground_state_eigensolver.py", line 111, in solve
raw_mes_result = self._solver.compute_minimum_eigenvalue(main_operator, aux_ops)
File "C:\Users\poc\Anaconda3\envs\qiskit\lib\site-packages\qiskit_nature\runtime\vqe_program.py", line 284, in compute_minimum_eigenvalue
raise RuntimeError(f"The job {job.job_id()} failed unexpectedly.") from exc
RuntimeError: The job c6kd626gkavn0ge25jng failed unexpectedly.
Steps to reproduce
ansatz = EfficientSU2()
backend = provider.get_backend('ibmq_qasm_simulator')
quantum_instance = QuantumInstance(backend=backend, optimization_level=3)
optimizer = SPSA(maxiter=10)
minimum_eigen_solver = VQEProgram(
ansatz=ansatz, optimizer=optimizer, provider=provider, backend=backend
)
result = ground_state_solver.solve(problem=problem)
Expected behavior
Suggested solutions
Error message might be explicit or Runtime VQEProgram might use predefined default parameters
Additional Information
What is the expected feature or enhancement?
A new search parameter has been added here. Users should be able to query by search keywords in the program name and description
A user should be able to create a session with a running program and execute it multiple times by passing slightly different parameters to the program each time.
What is the expected feature or enhancement?
A user should be able to call the sampler program by calling a short cut method called sample()
in IBMRuntimeService
.
Inputs and outputs of sample()
still needs to be decided.
What is the expected feature or enhancement?
A user should be able to call the estimator program by calling a short cut method called estimate()
in IBMRuntimeService
.
Inputs and outputs of estimate()
still needs to be decided.
What is the expected feature or enhancement?
When uploading a program, make program description optional. (NTC 817)
What is the expected feature or enhancement?
The credentials module is superseded by an accounts module and a ClientParameters class. Let's use this issue to clean this up by removing credentials from our code.
Acceptance criteria
Removed directory qiskit_ibm_runtime/credentials and updated all references. CI build passes.
Move latest code from qiskit-ibm and cleanup modules that are not required for this package.
Use Black Code Style instead of pycodestyle
.
What is the expected feature or enhancement?
Increased development efficiency, because
pycodestyle
leaves room for thatpycodestyle
requires developers to fix identified style issues manuallyInspired from Qiskit/qiskit#6361.
Technical Implementation
black
black folder1 folder 2
black --check folder1 folder2
returns a non-zero exit code (to force contributors to adhere to the new code style)What is the expected feature or enhancement?
Some workflow actions use tox for creating virtual environments (e.g. Build Docs), others don’t (e.g. lint & mypy). Also, some of the configurations in tox.ini appear outdated or unused.
The goal of this issue is to make it clear (e.g. for new contributors) what to use tox for and use it consistently in the Github actions.
I run a circuit that contains a single x
gate with 1 shot on the ibmq_lima
. Here is the result. Could you please help interpret it?
What is the difference between "Running: 6.2s" and "time in system 2.1s"?
Does it seem very slow to take 2.1 seconds to run a single shot?
I assume the 2.1s
is perhaps some sort of fixed cost. I also run 1000 shots. It takes 2.4s
. If my assumption is correct, it would take ibmq_lima (2.4 - 2.1 = 0.3s)
to complete 1000 shots. That is still 2000 times slower than a classical simulator running on my cheap laptop.
I read this paper here: https://arxiv.org/abs/2110.14108, but that paper does not have a lot of real life examples. Is it possible to apply the theories presented in that paper to my example presented above?
I hope you would provide some practical benchmarks in the future. For example, you may benchmark some well-known algorithms: Shor, QFT, QPE, ground state energy, etc., on your real quantum hardware. Benchmarking them that way may not sound rigorous, but it may be more useful to average users such as a scientist, an engineer, etc.
What is the expected feature or enhancement?
This is a follow-up item for #40 (comment).
We have disabled a few pylint rules to unblock an update to the latest Python / pylint version. Below rules have been marked with a TODO and should be reenabled when the code has been fixed:
Describe the bug
test_coder_operators failing since Qiskit 0.33.1 release.
https://github.com/Qiskit/qiskit-ibm-runtime/runs/4480457762?check_suite_focus=true#step:5:586
Steps to reproduce
Expected behavior
Suggested solutions
Additional Information
What is the expected feature or enhancement?
Mypy should also check test code and fail if typing issues are found. Would have avoided #80 (review) where tests had to fail to uncover that tests have not been updated to the latest method signatures.
What is the expected feature or enhancement?
I like the use of https://coveralls.io/ in https://github.com/Qiskit/qiskit-terra and other qiskit packages for reviewing code coverage.
Goal
Let's discuss and decide as part of this issue if we want something similar (e.g. ability to review code coverage over time, to see comments in PRs with coverage details [example]) in the provider repositories.
See also
A user should basically be able to run a program, run sampler, run estimator, view, view all and delete jobs. This epic can be used to track other enhancements related to jobs.
What is the expected feature or enhancement?
Change default cloud URL from "https://us-east.quantum-computing.cloud.ibm.com" to "https://cloud.ibm.com" (so it'll be easier when we do human readable CRN).
Acceptance criteria
Obvious
Describe the bug
6 test cases started failing without code changes in qiskit-ibm-runtime.
Steps to reproduce
Run PR tests
Preliminary analysis
Inspected the objects where self.assertEqual
now fails with the aid of the debugger. In the failing cases op.coeff != decoded.coeff
.
qiskit-terra
is not pinned to a specific version in qiskit-ibm-runtime
(code)
What is the expected feature or enhancement?
Since there was a lot of rewrite and reusing old test cases, we should ensure the test cases provide sufficient coverage. This can be done manually or use some kind of tool as mentioned in #22.
Acceptance criteria
Verify there is sufficient test coverage.
A user should basically be able to create, view, view all, update and delete program data and metadata. This epic can be used to track other enhancements made to programs for runtime 0.1 release.
What is the expected feature or enhancement?
In qiskit-ibmq-provider there was an IQX dashboard that displayed backends as well as legacy jobs. It'd be nice to have something similar, especially for cloud runtime since they don't show up on IQX.
Acceptance criteria
A user can see runtime backend and job information on a dashboard.
Describe the bug
It is now optional to pass in options to service.run. (Since a backend will get selected automatically when one is not specified in options) When we do that we get the below error.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/var/folders/jt/2qwx0rx17tl94gnll6wjftjc0000gn/T/ipykernel_52337/2427600266.py in <module>
2 "iterations": 1
3 }
----> 4 job = service.run(program_id="hello-world-mARpjmlEe9", inputs=inputs)
~/Documents/quantum/qiskit-ibm-runtime/qiskit_ibm_runtime/ibm_runtime_service.py in run(self, program_id, inputs, options, callback, result_decoder, instance)
813 if isinstance(options, dict):
814 options = RuntimeOptions(**options)
--> 815 options.validate(self.auth)
816
817 backend = None
AttributeError: 'NoneType' object has no attribute 'validate'
Steps to reproduce
from qiskit_ibm_runtime import IBMRuntimeService
service = IBMRuntimeService() # assuming there is a saved cloud account
inputs = {
"iterations": 1
}
job = service.run(program_id="hello-world-mARpjmlEe9", inputs=inputs)
Expected behavior
Should not get that error.
Suggested solutions
Additional Information
Describe the bug
I got the error when I executed Nature runtime tutorial: https://qiskit.org/documentation/nature/tutorials/07_leveraging_qiskit_runtime.html on 'ibmq_qasm_simulator'.
Steps to reproduce
I selected the simulator as the backend:
from qiskit import IBMQ
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q', group='open', project='main')
backend = provider.get_backend('ibmq_qasm_simulator')
and set the same VQEProgram as the tutorial, and executed below;
runtime_vqe_groundstate_solver = GroundStateEigensolver(qubit_converter, runtime_vqe)
runtime_vqe_result = runtime_vqe_groundstate_solver.solve(problem)
then I got;
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-11-b7ecbb463844> in <module>
1 runtime_vqe_groundstate_solver = GroundStateEigensolver(qubit_converter, runtime_vqe)
----> 2 runtime_vqe_result = runtime_vqe_groundstate_solver.solve(problem)
~/opt/anaconda3/envs/qiskit0331_3/lib/python3.8/site-packages/qiskit_nature/algorithms/ground_state_solvers/ground_state_eigensolver.py in solve(self, problem, aux_operators)
111 raw_mes_result = self._solver.compute_minimum_eigenvalue(main_operator, aux_ops)
112
--> 113 result = problem.interpret(raw_mes_result)
114 return result
115
~/opt/anaconda3/envs/qiskit0331_3/lib/python3.8/site-packages/qiskit_nature/problems/second_quantization/electronic/electronic_structure_problem.py in interpret(self, raw_result)
164 result = ElectronicStructureResult()
165 result.combine(eigenstate_result)
--> 166 self._grouped_property_transformed.interpret(result)
167 result.computed_energies = np.asarray([e.real for e in eigenstate_result.eigenenergies])
168 return result
~/opt/anaconda3/envs/qiskit0331_3/lib/python3.8/site-packages/qiskit_nature/properties/grouped_property.py in interpret(self, result)
104 """
105 for prop in self._properties.values():
--> 106 prop.interpret(result)
~/opt/anaconda3/envs/qiskit0331_3/lib/python3.8/site-packages/qiskit_nature/properties/second_quantization/electronic/particle_number.py in interpret(self, result)
187
188 if aux_op_eigenvalues[0] is not None:
--> 189 n_particles = aux_op_eigenvalues[0][0].real # type: ignore
190 result.num_particles.append(n_particles)
191
TypeError: 'float' object is not subscriptable
Expected behavior
Same as the tutorial, no message is expected.
Suggested solutions
Additional Information
qiskit-terra | 0.19.1
qiskit-aer | 0.9.1
qiskit-ignis | 0.7.0
qiskit-ibmq-provider | 0.18.2
qiskit | 0.33.1
qiskit-nature | 0.2.2
qiskit-finance | 0.2.1
qiskit-optimization | 0.2.3
qiskit-machine-learning | 0.2.1
Python version | 3.8.5
OS | Darwin
What is the expected feature or enhancement?
When saving credentials to disk today we use ~/.qiskit/qiskitrc
file. We can refactor and simplify a lot of the code around this functionality by saving credentials in a JSON file.
Something like in ~/.qiskit/qiskit-ibm.json
.
{
"cloud": {
"token": "<paste_API_KEY_here>",
"locator": "<paste_CRN_here>"
},
"legacy": {
"token": "<paste_API_KEY_here>",
"locator": "<paste_API_URL_here>",
"verify": True,
"default_hgp": "hub/group/project"
},
"cloud-staging": {
"token": "<paste_Staging_API_KEY_here>",
"locator": "<paste_Staging_CRN_here>"
},
"legacy-staging": {
"token": "<paste_Staging_API_KEY_here>",
"locator": "<paste_API_URL_here>",
"verify": True,
"default_hgp": "hub/group/project"
}
}
We can allow users to store multiple credentials by specifying a name
when saving an account. In the above example the user has saved their staging cloud and legacy accounts by passing the names cloud-staging
and legacy-staging
.
IBMRuntimeService.save_account(token, name="cloud-staging") # save like this
IBMRuntimeService(name="cloud-staging") # initialize like this
Describe the bug
circuit-runner ends in JobStatus.ERROR: 'job incurred error'
RuntimeJobFailureError: 'Unable to retrieve job result. Job c6oeij749l014bc1li40 has failed:\n2021-12-08T17:20:17.898524224Z /usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py:1044: UserWarning: The qiskit version used to generate the provided QPY file, 0.19.0, is newer than the current qiskit version 0.18.3. This may result in an error if the QPY file uses instructions not present in this current qiskit version\n2021-12-08T17:20:17.898607193Z warnings.warn(\n2021-12-08T17:20:17.900382476Z Traceback (most recent call last):\n2021-12-08T17:20:17.900445376Z File "/code/program_starter.py", line 61, in <module>\n2021-12-08T17:20:17.900466190Z user_params = json.loads(params, cls=RuntimeDecoder)\n2021-12-08T17:20:17.900484234Z File "/usr/local/lib/python3.8/json/__init__.py", line 370, in loads\n2021-12-08T17:20:17.900502446Z return cls(**kw).decode(s)\n2021-12-08T17:20:17.900524499Z File "/usr/local/lib/python3.8/json/decoder.py", line 337, in decode\n2021-12-08T17:20:17.900540271Z obj, end = self.raw_decode(s, idx=_w(s, 0).end())\n2021-12-08T17:20:17.900557031Z File "/usr/local/lib/python3.8/json/decoder.py", line 353, in raw_decode\n2021-12-08T17:20:17.900574133Z obj, end = self.scan_once(s, idx)\n2021-12-08T17:20:17.900591325Z File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 229, in object_hook\n2021-12-08T17:20:17.900608293Z return _decode_and_deserialize(obj_val, qpy_serialization.load)[0]\n2021-12-08T17:20:17.900624306Z File "/usr/local/lib/python3.8/site-packages/qiskit/providers/ibmq/runtime/utils.py", line 87, in _decode_and_deserialize\n2021-12-08T17:20:17.900642771Z orig = deserializer(buff)\n2021-12-08T17:20:17.900659013Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1053, in load\n2021-12-08T17:20:17.900676157Z circuits.append(_read_circuit(file_obj))\n2021-12-08T17:20:17.900692123Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 1058, in _read_circuit\n2021-12-08T17:20:17.900709416Z header, name, metadata = _read_header(file_obj)\n2021-12-08T17:20:17.900725306Z File "/usr/local/lib/python3.8/site-packages/qiskit/circuit/qpy_serialization.py", line 467, in _read_header\n2021-12-08T17:20:17.900741567Z metadata = json.loads(metadata_raw)\n2021-12-08T17:20:17.900759109Z File "/usr/local/lib/python3.8/json/__init__.py", line 343, in loads\n2021-12-08T17:20:17.900775347Z s = s.decode(detect_encoding(s), \'surrogatepass\')\n2021-12-08T17:20:17.900792170Z File "/usr/local/lib/python3.8/encodings/utf_32_be.py", line 11, in decode\n2021-12-08T17:20:17.900807579Z return codecs.utf_32_be_decode(input, errors, True)\n2021-12-08T17:20:17.900823068Z UnicodeDecodeError: \'utf-32-be\' codec can\'t decode bytes in position 4-7: code point not in range(0x110000)\n'
Steps to reproduce
circ = QuantumCircuit(2)
circ.h(0)
circ.cx(0,1)
circ.measure_all()
from qiskit.providers.ibmq import RunnerResult
backend=provider.backend.ibmq_qasm_simulator
program_inputs = {
'circuits': circ,
}
options = {'backend_name': backend.name()}
job = provider.runtime.run(program_id="circuit-runner",
options=options,
inputs=program_inputs,
)
result = job.result(decoder=RunnerResult)
Expected behavior
Same job runs OK in qiskit 0.32.0 & 0.32.1
Additional Information
What is the expected feature or enhancement?
Copy tutorials from https://github.com/Qiskit-Partners/qiskit-runtime/tree/main/tutorials and update them to match latest syntax.
Acceptance criteria
qiskit-ibm-runtime is right now working fine with BackendV1. We need to upgrade it to support BackendV2.
Related Terra PRs:
Qiskit/qiskit#5885
Qiskit/qiskit#7323
Acceptance Criteria:
WIP (Rathish)
What is the expected feature or enhancement?
We currently have the following environment variables after porting code from qiskit-ibm.
QISKIT_IBM_RUNTIME_API_URL
QISKIT_IBM_RUNTIME_API_TOKEN
QISKIT_IBM_RUNTIME_HGP
QISKIT_IBM_RUNTIME_PRIVATE_HGP
QISKIT_IBM_RUNTIME_DEVICE
QISKIT_IBM_RUNTIME_USE_STAGING_CREDENTIALS
QISKIT_IBM_RUNTIME_STAGING_API_TOKEN
QISKIT_IBM_RUNTIME_STAGING_API_URL
QISKIT_IBM_RUNTIME_STAGING_DEVICE
QISKIT_IBM_RUNTIME_STAGING_PRIVATE_HGP
Once we add support for IBM Cloud authentication we should have the below environment variables.
QISKIT_IBM_CLOUD_API_LOCATOR
QISKIT_IBM_CLOUD_API_TOKEN
QISKIT_IBM_CLOUD_DEVICE
QISKIT_IBM_CLOUD_USE_STAGING_CREDENTIALS
QISKIT_IBM_CLOUD_STAGING_API_LOCATOR
QISKIT_IBM_CLOUD_STAGING_API_TOKEN
QISKIT_IBM_CLOUD_STAGING_DEVICE
QISKIT_IBM_API_TOKEN
QISKIT_IBM_API_LOCATOR
QISKIT_IBM_HGP
QISKIT_IBM_PRIVATE_HGP
QISKIT_IBM_DEVICE
QISKIT_IBM_USE_STAGING_CREDENTIALS
QISKIT_IBM_STAGING_API_TOKEN
QISKIT_IBM_STAGING_API_LOCATOR
QISKIT_IBM_STAGING_HGP
QISKIT_IBM_STAGING_PRIVATE_HGP
QISKIT_IBM_STAGING_DEVICE
Today we cache Qobj in the job after submission, so that it's readily available if the user wants to access it. The problem is, as the size of the machines increases, so does the size of the Qobjs. Caching Qobj in the job means Python cannot garbage collect it. This gets much worse if one submits many jobs in a single Python session, like many algorithms do.
Instead of keep a reference to the Qobj in the job, we can just retrieve it on demand. It'd be slower for users who references the Qobj multiple times, but they can easily keep a local reference rather than doing job.circuits()
each time.
Describe the bug
After using IBMRuntimeService
in a Python CLI session, when exiting it generated a bunch of TypeError
:
Exception ignored in: <function RetrySession.__del__ at 0x13fd5cd30>
Traceback (most recent call last):
File "/Users/jessieyu/Documents/Q/Github/qiskit-ibm-runtime/qiskit_ibm_runtime/api/session.py", line 173, in __del__
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/requests/sessions.py", line 747, in close
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/requests/adapters.py", line 325, in close
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/urllib3/poolmanager.py", line 222, in clear
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/urllib3/_collections.py", line 100, in clear
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/urllib3/poolmanager.py", line 173, in <lambda>
File "/Users/jessieyu/.pyenv/versions/qiskit-ibm-runtime/lib/python3.8/site-packages/urllib3/connectionpool.py", line 494, in close
TypeError: catching classes that do not inherit from BaseException is not allowed
Exception ignored in: <function RetrySession.__del__ at 0x13fd5cd30>
Traceback (most recent call last):
Steps to reproduce
>>> from qiskit_ibm_runtime import IBMRuntimeService
>>> service = IBMRuntimeService()
>>> backend = service.least_busy()
<ctrl-D>
Expected behavior
Suggested solutions
Additional Information
This issue is meant to give an overall status overview related to the enablement of IBMRuntimeService
APIs for Cloud runtime support (0.1) in the qiskit-ibm-runtime
library.
Must have:
Theme | IBMRuntimeService API | Status Legacy | Status Cloud |
---|---|---|---|
Authentication | active_account |
✅ | ✅ |
Authentication | delete_account |
✅ | ✅ |
Authentication | save_account |
✅ | ✅ |
Authentication | accounts |
✅ | ✅ |
Authentication | logout |
🚫 | 🚫 |
Programs | delete_program |
✅ | ✅ |
Programs | pprint_programs |
✅ | ✅ |
Programs | program |
✅ | ✅ |
Programs | programs |
✅ | ✅ |
Programs | set_program_visibility |
✅ | ✅ |
Programs | update_program |
✅ | ✅ |
Programs | upload_program |
✅ | ✅ |
Jobs | delete_job |
✅ | ✅ |
Jobs | job |
✅ | ✅ |
Jobs | jobs |
✅ | ✅ |
Jobs | run |
✅ | ✅ |
Jobs | run_circuits |
🚫 | 🚫 |
Jobs | sample |
🚫 | 🚫 |
Jobs | estimate |
🚫 | 🚫 |
Backends | backends |
✅ | ✅ |
Backends | backend |
✅ | ✅ |
Other | my_reservations |
🚫 | 🚫 |
BackendV2 | 🔜 | 🔜 #102 | |
API Documentation | ✅ | ✅ | |
Tutorials | ✅ | ||
Merge in qiskit-ibm repo |
✅ | ✅ |
Nice to have (in priority order):
✅ = done (i.e. users can run IBMRuntimeService().xxx
or IBMRuntimeService.yyy
for static methods)
🚫 = not supported
🔜 = work in progress (links to a PR)
Background and Goal
Let's revisit if the Authors and Citation section in the README is needed and up-to-date. Currently there's a link to the BibTex file in the main Qiskit repository but the generate_authors script does not yet take qiskit/qiskit-ibm-runtime
into account.
What is the expected feature or enhancement?
The doc
workflow (in particular the tox -edocs
) command currently fails. This needs to be fixed to fix the CI checks.
Preliminary analysis
Likely caused by invalid automodule references in some of the .rst
files in https://github.com/Qiskit/qiskit-ibm-runtime/tree/main/docs/apidocs. Needs updates to accomodate the repository split.
What is the expected feature or enhancement?
This is a manual testing task to test qiskit-ibm-runtime against the new real backends on IBM Cloud.
Acceptance criteria
What is the expected feature or enhancement?
In qiskit-ibmq-provider users could opt-in to HTML representation of IBM backends by importing qiskit.providers.ibmq.jupyter
# cf. https://github.com/Qiskit/qiskit-ibmq-provider/blob/master/docs/tutorials/2_jupyter_tools.ipynb
import qiskit.providers.ibmq.jupyter # This is the where the magic happens (literally).
from qiskit.providers.ibmq import least_busy
backend = least_busy(...)
backend
As a result the backend information was displayed as an HTML widget
The related code has been ported to qiskit-ibm-runtime
but not been updated to work with latest code changes. Therefore displaying a backend fails when qiskit_ibm_runtime.jupyter
is imported. As this is not a documented API, it's not an issue that users are likely to hit.
import qiskit_ibm_runtime.jupyter
backend = # ...
backend
Acceptance criteria
What is the expected feature or enhancement?
The following repository secrets need to be setup, for which I don't know the values for. @mtreinish Could you please help setup these?
ENCRYPTED_DEPLOY_PO_BRANCH_IV
ENCRYPTED_DEPLOY_PO_BRANCH_KEY
PYPI_API_TOKEN
What is the expected feature or enhancement?
The old qiskit-ibmq-provider
save_account()
method required you to specify overwrite=True
if the account you're trying to save already exists. This is handy to avoid accidental overwrite.
Acceptance criteria
A saved account can only be overwritten if overwrite=True
is specified on save_account()
.
What is the expected feature or enhancement?
As a maintainer, I want to release a new version with confidence in a fully automated way.
As-is
Some parts of the release (e.g. push to PyPi) are already automated and triggered when a tag is pushed. Others (e.g. generation of release notes, verification of tests) involve manual steps.
Compiling all of the consistently failing cron job tests here to avoid constantly scrolling through all the logs
Also makes it easier to track
Tests that failed multiple times in past 30 days:
Cron prod
test_retrieve_interim_results
, test_run_program_failed
linktest_stream_results_done
, test_retrieve_job_running
linktest_job_logs
linkCron staging
Slow test
test_callback_cancel_job
, test_retrieve_interim_results
linktest_retrieve_unauthorized_program_data
linktest_retrieve_returned_jobs
linkTerra main
test_run_program_real_device
linkwill check the cron jobs daily to keep this issue updated
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.