Skip to content

Commit

Permalink
Updating name from active volume to all to all
Browse files Browse the repository at this point in the history
  • Loading branch information
pediejo committed Oct 6, 2024
1 parent 6082ad3 commit 26590dc
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 28 deletions.
6 changes: 3 additions & 3 deletions examples/ex_1_from_qasm.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from benchq.resource_estimators.graph_estimator import GraphResourceEstimator
from benchq.logical_architecture_modeling.graph_based_logical_architectures import (
TwoRowBusArchitectureModel,
ActiveVolumeArchitectureModel,
AllToAllArchitectureModel,
)


Expand Down Expand Up @@ -54,13 +54,13 @@ def main(file_name):
destination="single-thread",
)

active_volume_architecture = ActiveVolumeArchitectureModel()
all_to_all_architecture = AllToAllArchitectureModel()

# Put all the pieces together to get a resource estimate
gsc_resource_estimates = estimator.compile_and_estimate(
algorithm_implementation,
compiler,
active_volume_architecture,
all_to_all_architecture,
architecture_model,
)
print("Resource estimation results:")
Expand Down
4 changes: 2 additions & 2 deletions examples/ex_2_time_evolution.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from benchq.resource_estimators.graph_estimator import GraphResourceEstimator
from benchq.logical_architecture_modeling.graph_based_logical_architectures import (
TwoRowBusArchitectureModel,
ActiveVolumeArchitectureModel,
AllToAllArchitectureModel,
)
from benchq.timing import measure_time

Expand Down Expand Up @@ -80,7 +80,7 @@ def main():
)

two_row_architecture = TwoRowBusArchitectureModel()
active_volume_architecture = ActiveVolumeArchitectureModel()
active_volume_architecture = AllToAllArchitectureModel()

graph_estimator = GraphResourceEstimator(optimization="Time", verbose=True)

Expand Down
6 changes: 3 additions & 3 deletions src/benchq/compilation/graph_states/jabalizer_wrapper.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ function run_jabalizer(
optimization,
verbose,
)
elseif logical_architecture_name == "active_volume"
elseif logical_architecture_name == "all_to_all"
(graph_creation_tocks_per_layer, t_states_per_layer, rotations_per_layer) =
active_volume_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose)
all_to_all_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose)
else
throw(ArgumentError("Logical architecture must be either two_row_bus or active_volume."))
throw(ArgumentError("Logical architecture must be either two_row_bus or all_to_all."))
end
python_compiled_data = Dict(
"num_logical_qubits" => num_logical_qubits,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ function run_ruby_slippers(
if logical_architecture_name == "two_row_bus"
(graph_creation_tocks_per_layer, t_states_per_layer, rotations_per_layer) =
two_row_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose)
elseif logical_architecture_name == "active_volume"
elseif logical_architecture_name == "all_to_all"
(graph_creation_tocks_per_layer, t_states_per_layer, rotations_per_layer) =
active_volume_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose)
all_to_all_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose)
else
throw(ArgumentError("Logical architecture must be either two_row_bus or active_volume."))
throw(ArgumentError("Logical architecture must be either two_row_bus or all_to_all."))
end
python_compiled_data = Dict(
"num_logical_qubits" => num_logical_qubits,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ function two_row_scheduler(asg, pauli_tracker, num_logical_qubits, optimization,
end


function active_volume_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose=false)
function all_to_all_scheduler(asg, pauli_tracker, num_logical_qubits, optimization, verbose=false)
if optimization == "Time"
return time_optimal_active_volume_scheduler(asg, pauli_tracker, num_logical_qubits, verbose)
return time_optimal_all_to_all_scheduler(asg, pauli_tracker, num_logical_qubits, verbose)
else
throw(ArgumentError("Invalid optimization type."))
end
Expand Down Expand Up @@ -232,8 +232,8 @@ function space_optimal_two_row_scheduler(asg, pauli_tracker, num_logical_qubits,
return num_tocks_for_graph_creation, num_t_states_per_layer, num_rotations_per_layer
end

function time_optimal_active_volume_scheduler(asg, pauli_tracker, num_logical_qubits, verbose=false)
# Here we model the active volume scheduler as a two row scheduler with the following modifications:
function time_optimal_all_to_all_scheduler(asg, pauli_tracker, num_logical_qubits, verbose=false)
# Here we model the all-to-all scheduler as a two row scheduler with the following modifications:
# 1. The order of patches can be reconfigured "for free"
# 2. No bus is needed because stabilizer measurements can be made via lattice
# surgery operations on the boundaries of patches
Expand Down Expand Up @@ -277,7 +277,7 @@ function time_optimal_active_volume_scheduler(asg, pauli_tracker, num_logical_qu


# Compute number of tocks for graph state creation using greedy graph coloring on extension graph
num_tocks_for_graph_creation[layer_num] += compute_active_volume_tocks_to_prepare_subgraph(asg.edge_data, subnodes_this_layer)
num_tocks_for_graph_creation[layer_num] += compute_all_to_all_tocks_to_prepare_subgraph(asg.edge_data, subnodes_this_layer)

if layer_num < length(pauli_tracker.layering)
union!(measured_nodes, pauli_tracker.layering[layer_num])
Expand Down Expand Up @@ -336,7 +336,7 @@ Args:
Returns:
num_tocks::Int Number of tocks to prepare the graph state
"""
function active_volume_greedy_group_neighborhoods(asg, subnodes_this_layer)
function all_to_all_greedy_group_neighborhoods(asg, subnodes_this_layer)
# Construct set of neighborhoods
neighborhoods = []
for node in subnodes_this_layer
Expand Down Expand Up @@ -468,7 +468,7 @@ end
# Note: this function doesn't keep track of the groups as would be
# needed by a compiler, but only accounts for the number of tocks that would
# result from a lattice surgery compilation.
function compute_active_volume_tocks_to_prepare_subgraph(edge_data, subnodes, coloring_algorithm=Graphs.degree_greedy_color)
function compute_all_to_all_tocks_to_prepare_subgraph(edge_data, subnodes, coloring_algorithm=Graphs.degree_greedy_color)
# Check if the graph is empty
if length(subnodes) == 0
return 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,10 +391,10 @@ def consume_t_measurements(
return remaining_t_measurements_per_node


class ActiveVolumeArchitectureModel(GraphBasedLogicalArchitectureModel):
class AllToAllArchitectureModel(GraphBasedLogicalArchitectureModel):
def __init__(self):
super().__init__()
self._name = "active_volume"
self._name = "all_to_all"

def generate_spatial_resource_breakdown(
self,
Expand All @@ -413,7 +413,7 @@ def generate_spatial_resource_breakdown(
)
)

# The active volume architecture uses no bus qubits
# The all-to-all architecture uses no bus qubits
num_logical_bus_qubits = 0

return LogicalArchitectureResourceInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ def test_generate_extension_graph():
)


def test_compute_active_volume_tocks():
def test_compute_all_to_all_tocks():
# Define the edge_data and nodes in Python
edge_data = [{3}, {3}, {1, 2, 4}, {3, 5}, {4}]
nodes = {1, 2, 5}

# Define the expected outputs
expected_active_volume_tocks = 2
expected_all_to_all_tocks = 2

# Convert Python sets and lists to Julia-compatible formats using utility functions
edge_data_julia_vector = to_julia_vector_of_sets(edge_data)
nodes_julia = to_julia_set(nodes)

# Call the Julia function
output = jl.compute_active_volume_tocks_to_prepare_subgraph(
output = jl.compute_all_to_all_tocks_to_prepare_subgraph(
edge_data_julia_vector, nodes_julia
)

# then
assert output == expected_active_volume_tocks
assert output == expected_all_to_all_tocks
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from benchq.logical_architecture_modeling.graph_based_logical_architectures import (
GraphBasedLogicalArchitectureModel,
TwoRowBusArchitectureModel,
ActiveVolumeArchitectureModel,
AllToAllArchitectureModel,
consume_t_measurements,
)

Expand Down Expand Up @@ -85,7 +85,7 @@
"number_of_data_qubits": 5,
"number_of_bus_qubits": 0,
},
ActiveVolumeArchitectureModel(),
AllToAllArchitectureModel(),
),
],
)
Expand Down
1 change: 0 additions & 1 deletion tests/benchq/resource_estimators/test_graph_estimator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
)
from benchq.logical_architecture_modeling.graph_based_logical_architectures import (
TwoRowBusArchitectureModel,
ActiveVolumeArchitectureModel,
)
from benchq.decoder_modeling import DecoderModel
from benchq.problem_embeddings.quantum_program import QuantumProgram
Expand Down

0 comments on commit 26590dc

Please sign in to comment.