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

Issue 742 | Docs: remove outdated terms #815

Merged
merged 1 commit into from
Jul 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions client/quantum_serverless/core/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ def from_dict(cls, dictionary: dict):
class CircuitMeta:
"""Circuit metainformation."""

n_qubits: int
num_qubits: int
depth: int

def to_seq(self) -> Sequence[int]:
"""Converts meta to seq."""
return [self.n_qubits, self.depth]
return [self.num_qubits, self.depth]


Numeric = Union[float, int]
Expand All @@ -151,7 +151,7 @@ def fetch_execution_meta(*args, **kwargs) -> Dict[str, Sequence[Numeric]]:

def fetch_meta(circuit: QuantumCircuit) -> CircuitMeta:
"""Returns meta information from circuit."""
return CircuitMeta(n_qubits=circuit.num_qubits, depth=circuit.depth())
return CircuitMeta(num_qubits=circuit.num_qubits, depth=circuit.depth())

meta: Dict[str, Sequence[Numeric]] = {}

Expand Down
4 changes: 2 additions & 2 deletions docs/development/examples/07_benchmark_program.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"- `n_entries` - number of circuits and observables will be used in each iteration on generation task.\n",
"- `depth_of_recursion` - defines how many recursive iterations generation task will have. (Number of generated circuits will be n_entries * depth_of_recursion).\n",
"- `n_backends` - number of backends, which defines how many parallel transpilations and estimations will happen.\n",
"- `n_qubits` - number of qubits will be used in a program. Affects backends, circuits and observables.\n",
"- `num_qubits` - number of qubits will be used in a program. Affects backends, circuits and observables.\n",
"- `circuit_depth` - depth of generated circuits.\n",
"- `size_of_observable` - size of generated observables.\n",
"- `n_graphs` - number of times graph above will be executed within one program.\n",
Expand Down Expand Up @@ -95,7 +95,7 @@
")\n",
"\n",
"job = serverless.run(program, arguments={\n",
" \"n_qubits\": 2,\n",
" \"num_qubits\": 2,\n",
" \"n_entries\": 2,\n",
" \"depth_of_recursion\": 4,\n",
" \"n_backends\": 3,\n",
Expand Down
32 changes: 16 additions & 16 deletions docs/development/examples/source_files/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,62 +27,62 @@

@distribute_task()
def generate_circuits(
depth_of_recursion: int, n_qubits: int, depth_of_circuit: int, n_circuits: int
depth_of_recursion: int, num_qubits: int, depth_of_circuit: int, n_circuits: int
):
"""Generates random circuits."""
circuits = [random_circuit(n_qubits, depth_of_circuit) for _ in range(n_circuits)]
circuits = [random_circuit(num_qubits, depth_of_circuit) for _ in range(n_circuits)]
if depth_of_recursion <= 1:
return circuits
else:
return circuits + get(
generate_circuits(
depth_of_recursion - 1, n_qubits, depth_of_circuit, n_circuits
depth_of_recursion - 1, num_qubits, depth_of_circuit, n_circuits
)
)


@distribute_task()
def generate_observables(
depth_of_recursion: int, n_qubits: int, size: int, n_observables: int
depth_of_recursion: int, num_qubits: int, size: int, n_observables: int
):
"""Generated random observables."""
observables = [random_pauli_list(n_qubits, size) for _ in range(n_observables)]
observables = [random_pauli_list(num_qubits, size) for _ in range(n_observables)]
if depth_of_recursion <= 1:
return observables
else:
return observables + get(
generate_observables(depth_of_recursion - 1, n_qubits, size, n_observables)
generate_observables(depth_of_recursion - 1, num_qubits, size, n_observables)
)


@distribute_task()
def generate_data(
depth_of_recursion: int,
n_qubits: int,
num_qubits: int,
n_entries: int,
circuit_depth: int = 2,
size_of_observable: int = 2,
):
return get(
generate_circuits(
depth_of_recursion=depth_of_recursion,
n_qubits=n_qubits,
num_qubits=num_qubits,
n_circuits=n_entries,
depth_of_circuit=circuit_depth,
)
), get(
generate_observables(
depth_of_recursion=depth_of_recursion,
n_qubits=n_qubits,
num_qubits=num_qubits,
size=size_of_observable,
n_observables=n_entries,
)
)


def get_backends(n_backends: int, n_qubits: int):
def get_backends(n_backends: int, num_qubits: int):
"""Returns list of backends for program."""
backend = ConfigurableFakeBackend("Tashkent", n_qubits=n_qubits, version=1)
backend = ConfigurableFakeBackend("Tashkent", n_qubits=num_qubits, version=1)

return [backend for _ in range(n_backends)]

Expand All @@ -104,18 +104,18 @@ def estimate(circuits: list, observables: list):
@distribute_task()
def run_graph(
depth_of_recursion: int,
n_qubits: int,
num_qubits: int,
n_entries: int,
circuit_depth: int,
size_of_observable: int,
n_backends: int,
):
backends = get_backends(n_backends, n_qubits)
backends = get_backends(n_backends, num_qubits)

circuits, observables = get(
generate_data(
depth_of_recursion=depth_of_recursion,
n_qubits=n_qubits,
num_qubits=num_qubits,
n_entries=n_entries,
circuit_depth=circuit_depth,
size_of_observable=size_of_observable,
Expand All @@ -140,7 +140,7 @@ def run_graph(
type=int,
)
parser.add_argument(
"--n_qubits", help="Number of qubits used in program.", default=2, type=int
"--num_qubits", help="Number of qubits used in program.", default=2, type=int
)
parser.add_argument("--n_entries", help="Number of circuits.", default=10, type=int)
parser.add_argument(
Expand All @@ -167,7 +167,7 @@ def run_graph(
[
run_graph(
depth_of_recursion=args.depth_of_recursion,
n_qubits=args.n_qubits,
num_qubits=args.num_qubits,
n_entries=args.n_entries,
circuit_depth=args.circuit_depth,
size_of_observable=args.size_of_observable,
Expand Down