Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge qiskit-runtime into qiskit-ibm-runtime #91

Merged
merged 116 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
116 commits
Select commit Hold shift + click to select a range
2a86769
Initial commit
jyu00 Apr 28, 2021
6238087
[WIP] Add RuntimeResult class
nonhermitian May 3, 2021
4089a86
change headers
nonhermitian May 3, 2021
7f0e711
cleanup
nonhermitian May 3, 2021
9a9ddfd
add setup file
nonhermitian May 3, 2021
ccd51b8
Add a quasidistribution test
nonhermitian May 3, 2021
ef49774
style fixes
nonhermitian May 3, 2021
1579f62
Start the documentation
nonhermitian May 3, 2021
7889bcf
Add classes
nonhermitian May 3, 2021
bc3edce
Add result to docs
nonhermitian May 3, 2021
aa8b02c
fix header
nonhermitian May 3, 2021
89690aa
tweak doc string
nonhermitian May 3, 2021
a610c1b
add intro and upload tutorials
jyu00 May 4, 2021
7bfe63f
remove bad import
jyu00 May 4, 2021
7aaa456
update some texts
ismaelfaro May 4, 2021
20ea6b9
move things into circuit-runner folder
nonhermitian May 4, 2021
8507a5c
rename to RunnerResult
nonhermitian May 4, 2021
2cbde67
move to runner
nonhermitian May 4, 2021
05b1596
update to runner dir
nonhermitian May 4, 2021
f79e51d
rename apidoc entry
nonhermitian May 4, 2021
8b63d42
Merge pull request #4 from ismaelfaro/intro-tutorial
jyu00 May 4, 2021
e468261
fix directories
jyu00 May 4, 2021
fb2a8d9
Move to automodapi
nonhermitian May 4, 2021
14857a0
remove unused docs
nonhermitian May 4, 2021
90609af
fix what I thought I fixed earlier
nonhermitian May 4, 2021
6c5f232
Merge pull request #1 from Qiskit-Partners/add-RuntimeResult
jyu00 May 4, 2021
fac7a8f
Merge branch 'main' into start-docs
nonhermitian May 4, 2021
57a9839
update docs requirements
nonhermitian May 4, 2021
3836092
add to/from json
jyu00 May 5, 2021
4dac8b9
Merge pull request #2 from Qiskit-Partners/start-docs
jyu00 May 5, 2021
eea187b
Fix docs doing inherited members
nonhermitian May 5, 2021
36c4761
Merge pull request #5 from Qiskit-Partners/docs-class-struct
jyu00 May 5, 2021
cce8cfb
rename intro
jyu00 May 5, 2021
0c94ad0
Merge remote-tracking branch 'origin/main' into intro-tutorial
jyu00 May 5, 2021
a5c91e3
fix json
jyu00 May 5, 2021
58140c9
add circuit runner tutorial
jyu00 May 5, 2021
da5bc59
update README
jyu00 May 5, 2021
33789c4
version should be string
jyu00 May 5, 2021
26c0438
add shields
jyu00 May 5, 2021
55b2599
fix json
jyu00 May 5, 2021
9f2fb2f
Merge pull request #3 from Qiskit-Partners/intro-tutorial
jyu00 May 5, 2021
45bc9e5
Merge remote-tracking branch 'origin/main' into circuit-runner-tutorial
jyu00 May 6, 2021
298cf11
fix plot
jyu00 May 6, 2021
3e8c379
Merge pull request #6 from Qiskit-Partners/circuit-runner-tutorial
nonhermitian May 6, 2021
8ff8925
Merge remote-tracking branch 'origin/main' into readme
jyu00 May 6, 2021
f8566cc
add 120x wording
jyu00 May 6, 2021
16244b4
Merge pull request #7 from Qiskit-Partners/readme
jyu00 May 6, 2021
870539d
Add CI configuration (#8)
mtreinish May 6, 2021
1c32fd5
Add ``VQEProgram`` (#9)
Cryoris May 7, 2021
e540c10
Adding QKA files (#12)
jenglick May 7, 2021
e265976
Add a tutorial for the VQE script and ``VQEProgram`` (#11)
Cryoris May 7, 2021
8f60b67
Fix circuit runner parameters (#14)
jyu00 May 7, 2021
7c5f243
Move circuit runner tests (#15)
nonhermitian May 7, 2021
ad5f537
remove program update from title (#16)
jyu00 May 7, 2021
f1d2fcd
Add docs logistics (#17)
nonhermitian May 7, 2021
78f10e5
Add some frontmatter (#18)
nonhermitian May 7, 2021
ba8b4da
Add docs meat (#19)
nonhermitian May 7, 2021
67febb2
add links (#20)
jyu00 May 7, 2021
881d163
Start a list of current runtime limitations (#21)
nonhermitian May 7, 2021
7a9fdae
Tweak the nav bar to simplify things (#22)
nonhermitian May 7, 2021
81ca4e1
Fix README text and link (#24)
jyu00 May 7, 2021
7395c0b
Add init file (#25)
jenglick May 7, 2021
a3bc26e
add API direct tutorial (#30)
ismaelfaro May 8, 2021
5620ff2
runtime to program inputs (#28)
jyu00 May 10, 2021
e282242
update the installation process (#33)
ismaelfaro May 10, 2021
0e8f0fc
Add lint configuration and run in CI (#27)
mtreinish May 10, 2021
d2d6a41
Remove API docs (#34)
nonhermitian May 10, 2021
395f5e2
Update installation wording in README (#35)
jyu00 May 10, 2021
8a4f9c7
move runnerresult import (#36)
jyu00 May 10, 2021
9825a5e
Move api direct tutorial from 05 to 01 (#32)
jyu00 May 10, 2021
108537a
Update intro wording (#39)
jyu00 May 10, 2021
dc6e82a
update qiskit requirements (#41)
jyu00 May 11, 2021
af47c39
Add circuit runner overview (#40)
nonhermitian May 11, 2021
2a73e3b
Move REST API to navbar (#42)
nonhermitian May 11, 2021
4aa9441
Update getting started (#43)
nonhermitian May 11, 2021
97faece
Build docs on merges with main (#44)
nonhermitian May 11, 2021
334de8e
Fix source path for docs upload
mtreinish May 11, 2021
0752db5
Update VQE tutorial (#45)
Cryoris May 11, 2021
932950e
Add qka files and figs (#37)
jenglick May 11, 2021
48074be
add qka and remove vqe (#47)
jyu00 May 12, 2021
7607d5f
Update documentation about simulator access (#49)
jyu00 May 18, 2021
64cc158
Update 01_circuit_runner.ipynb (#50)
beckykd May 28, 2021
48cb8a7
Rename runtime-simple to sample-program (#52)
jyu00 Jun 4, 2021
99d05e2
add querying for backends (#53)
jyu00 Jun 21, 2021
6e25df4
remove 5 circ limit on circuit runner (#55)
nonhermitian Jun 23, 2021
908e819
63 Add tests (#62)
LucyXing Aug 17, 2021
f08ab04
Update tutorials (#65)
LucyXing Sep 1, 2021
a6eada0
Add IEEE workshop tutorial (#67)
jyu00 Sep 9, 2021
a24338f
Remove system limitation (#68)
jyu00 Sep 16, 2021
259c7f3
update upload tutorial (#69)
LucyXing Sep 21, 2021
ec81a37
update tutorial (#71)
jyu00 Sep 28, 2021
6d27775
update requirements (#72)
jyu00 Sep 29, 2021
31994a4
Move IEEE tutorial (#73)
jyu00 Sep 29, 2021
b949981
Circuit runner tutorial not using proper format (#74)
jyu00 Sep 29, 2021
896974c
Update README.md (#75)
jaygambetta Sep 30, 2021
6473997
Update README.md (#76)
jaygambetta Oct 6, 2021
b59cb2e
Add full custom program tutorial (#77)
nonhermitian Oct 6, 2021
3c7dc17
fix some typos, lang consistency, etc. (#78)
abbycross Oct 6, 2021
0661e7a
Add back cell contents (#79)
nonhermitian Oct 6, 2021
e4c8908
Tweaks to full example based on review (#80)
nonhermitian Oct 6, 2021
8989f91
Fix readme to avoid saying premium users (#81)
jyu00 Oct 6, 2021
69cc1c9
Add UUID to program name in full example (#82)
nonhermitian Oct 6, 2021
44e613d
Add custom expval program (#83)
nonhermitian Oct 13, 2021
74eea39
Update IEEE tutorial (#84)
jyu00 Oct 19, 2021
92bd9c0
minor update the sample expval program (#85)
HwajungKang Oct 24, 2021
1661dd5
Add missing files (#86)
jyu00 Oct 25, 2021
85e7efb
Update tutorials (#90)
kwoane Nov 11, 2021
edc8333
Update wording on public programs (#88)
jyu00 Nov 11, 2021
4b76711
Add link to article on 120x quantum speedup (#91)
rathishcholarajan Nov 11, 2021
ba313c9
Introduction Tutorial - more updates (#92)
rathishcholarajan Nov 11, 2021
906473b
Update tutorials for ibmq-provider 0.18 (#93)
jyu00 Nov 11, 2021
484978d
QAOA runtime (#94)
eggerdj Jan 5, 2022
beb1070
71 rename sample_program to hello_world (#96)
LucyXing Jan 5, 2022
fa08d8a
remove files/folders no longer needed
daka1510 Jan 11, 2022
c831d1e
Merge remote-tracking branch 'qiskit-runtime/main' into merge-qiskit-…
daka1510 Jan 11, 2022
ce54b3c
delete notebook that is no longer needed
daka1510 Jan 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions qiskit_runtime/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Main entry point for the qiskit_runtime"""


try:
from .version import version as __version__
except ImportError:
__version__ = "0.0.0"
15 changes: 15 additions & 0 deletions qiskit_runtime/circuit_runner/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
Qiskit circuit runner module
"""
23 changes: 23 additions & 0 deletions qiskit_runtime/circuit_runner/circuit_runner.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "circuit-runner",
"description": "A runtime program that takes one or more circuits, compiles them, executes them, and optionally applies measurement error mitigation.",
"max_execution_time": 14400,
"version": "1.0",
"parameters": [
{"name": "circuits", "description": "A circuit or a list of circuits.", "type": "A QuantumCircuit or a list of QuantumCircuits.", "required": true},
{"name": "shots", "description": "Number of repetitions of each circuit, for sampling. Default: 1024.", "type": "int", "required": false},
{"name": "initial_layout", "description": "Initial position of virtual qubits on physical qubits.", "type": "dict or list", "required": false},
{"name": "layout_method", "description": "Name of layout selection pass ('trivial', 'dense', 'noise_adaptive', 'sabre')", "type": "string", "required": false},
{"name": "routing_method", "description": "Name of routing pass ('basic', 'lookahead', 'stochastic', 'sabre').", "type": "string", "required": false},
{"name": "translation_method", "description": "Name of translation pass ('unroller', 'translator', 'synthesis').", "type": "string", "required": false},
{"name": "seed_transpiler", "description": "Sets random seed for the stochastic parts of the transpiler.", "type": "int", "required": false},
{"name": "optimization_level", "description": "How much optimization to perform on the circuits (0-3). Higher levels generate more optimized circuits. Default is 1.", "type": "int", "required": false},
{"name": "init_qubits", "description": "Whether to reset the qubits to the ground state for each shot.", "type": "bool", "required": false},
{"name": "rep_delay", "description": "Delay between programs in seconds.", "type": "float", "required": false},
{"name": "transpiler_options", "description": "Additional compilation options.", "type": "dict", "required": false},
{"name": "measurement_error_mitigation", "description": "Whether to apply measurement error mitigation. Default is False.", "type": "bool", "required": false}
],
"return_values": [
{"name": "-", "description": "Circuit execution results.", "type": "RunnerResult object"}
]
}
68 changes: 68 additions & 0 deletions qiskit_runtime/circuit_runner/circuit_runner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Circuit-runner runtime program.

This is a simplified version of the circuit-runner program.
"""

from qiskit.compiler import transpile, schedule


def main(
backend,
user_messenger, # pylint: disable=unused-argument
circuits,
initial_layout=None,
seed_transpiler=None,
optimization_level=None,
transpiler_options=None,
scheduling_method=None,
schedule_circuit=False,
inst_map=None,
meas_map=None,
measurement_error_mitigation=False,
**kwargs,
):
"""Run the circuits on the backend."""

# transpiling the circuits using given transpile options
transpiler_options = transpiler_options or {}
circuits = transpile(
circuits,
initial_layout=initial_layout,
seed_transpiler=seed_transpiler,
optimization_level=optimization_level,
backend=backend,
**transpiler_options,
)

if schedule_circuit:
circuits = schedule(
circuits=circuits,
backend=backend,
inst_map=inst_map,
meas_map=meas_map,
method=scheduling_method,
)

if not isinstance(circuits, list):
circuits = [circuits]

# Compute raw results
result = backend.run(circuits, **kwargs).result()

if measurement_error_mitigation:
# Performs measurement error mitigation.
pass

return result.to_dict()
13 changes: 13 additions & 0 deletions qiskit_runtime/hello_world/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Package containing ``hello-world`` Qiskit quantum program."""
41 changes: 41 additions & 0 deletions qiskit_runtime/hello_world/hello_world.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "hello-world",
"description": "A sample runtime program.",
"max_execution_time": 300,
"spec": {
"backend_requirements": {
"min_num_qubits": 5
},
"parameters": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {
"iterations": {
"type": "integer",
"minimum": 0,
"description": "Number of iterations to run. Each iteration generates a runs a random circuit."
}
},
"required": [
"iterations"
]
},
"return_values": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"description": "A string that says 'All done!'.",
"type": "string"
},
"interim_results": {
"$schema": "https://json-schema.org/draft/2019-09/schema",
"properties": {
"iteration": {
"type": "integer",
"description": "Iteration number."
},
"counts": {
"description": "Histogram data of the circuit result.",
"type": "object"
}
}
}
}
}
55 changes: 55 additions & 0 deletions qiskit_runtime/hello_world/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# This code is part of qiskit-runtime.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""A sample runtime program called hello-world that submits random circuits
for user-specified iterations.
"""

import random
from typing import Any

from qiskit import transpile
from qiskit.circuit.random import random_circuit


def prepare_circuits(backend):
"""Generate a random circuit.

Args:
backend (qiskit.providers.Backend): Backend used for transpilation.

Returns:
qiskit.QuantumCircuit: Generated circuit.
"""
circuit = random_circuit(num_qubits=5, depth=4, measure=True, seed=random.randint(0, 1000))
return transpile(circuit, backend)


def main(backend, user_messenger, **kwargs) -> Any:
"""Main entry point of the program.

Args:
backend (qiskit.providers.Backend): Backend to submit the circuits to.
user_messenger (qiskit.providers.ibmq.runtime.UserMessenger): Used to communicate with the
program consumer.
kwargs: User inputs.

Returns:
Final result of the program.
"""
iterations = kwargs.pop("iterations", 1)
for it in range(iterations):
qc = prepare_circuits(backend)
result = backend.run(qc).result()
user_messenger.publish({"iteration": it, "counts": result.get_counts()})

return "All done!"
Loading