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

Transpiler refactor #1500

Merged
merged 37 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2c7190e
fix: update connectivity in default transpiler
Oct 17, 2024
e1e769a
fix: remove initial_layout & use wire_names & update test files
Oct 22, 2024
2a888ad
fix: update code-examples
Oct 23, 2024
05b6f68
fix: update comparison in test_bell_state_3q
Oct 23, 2024
876b79c
feat: circuit draw with int qubit names
Oct 23, 2024
02e9945
fix: placer.py coverage
Oct 23, 2024
05f36e7
fix: circuit.py coverage
Oct 23, 2024
01b667d
fix: router.py coverage
Oct 23, 2024
4e21132
fix: remove dead codes
Oct 24, 2024
12bf8b0
fix: refactor connectivity graphs in test files
Oct 24, 2024
36c1348
fix: return type of a router
Oct 24, 2024
f19dc6e
fix: minor changes
Oct 25, 2024
7534ef2
fix: remove add_nodes_from when setting backend
Oct 25, 2024
67fae1f
fix: Circuit remove default wire_names / dict wire_names
Oct 28, 2024
2ac1a85
fix: wire_names update docstrings
Oct 28, 2024
788fd06
fix: line connectivity remove fixture
Oct 28, 2024
4e3dbce
fix: test files default qubit
Oct 28, 2024
d4e507c
fix: refactor assert functions
Oct 28, 2024
5cf75b5
fix: refactor assert funcs
Oct 28, 2024
942991a
fix: pandoc update result draw()
Oct 28, 2024
25d8788
fix: pandoc update
Oct 28, 2024
93ac772
feat: Circuit __init__ int/list first arg init
Oct 28, 2024
41f5eff
fix: Circuit._parse -> _resolve_qubits
Oct 28, 2024
a4f2092
fix: minor updates / update docstring of qibo.Circuit
Oct 30, 2024
10be459
fix: update test files _resolve_qubits / wire_names setter
Oct 30, 2024
a1d3302
fix: combine similar assert func to assert_placement
Oct 30, 2024
0851eeb
fix: minor test files update
Oct 30, 2024
ec37f34
Merge branch 'master' into transpiler_refactor
Nov 4, 2024
32c9ac2
Merge branch 'master' into transpiler_refactor
csookim Nov 8, 2024
ff89c58
Merge branch 'master' into transpiler_refactor
Nov 19, 2024
824bb76
passes move connectivity check to __call__
Nov 21, 2024
214a4ea
fix: remove Trivial and Custom
Nov 22, 2024
abed4b9
fix: remove default star transpiler / enforce connectivity
Nov 22, 2024
ad079de
fix: modify is_satisfied
Nov 22, 2024
1f55f3c
fix: revert, make connectivity optiona
Nov 22, 2024
797331e
fix: type errors, Preprocessor connectivity check, utils.py -> assert…
Nov 25, 2024
049ff01
fix: utils -> asserts
Nov 25, 2024
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
Prev Previous commit
Next Next commit
fix: line connectivity remove fixture
  • Loading branch information
changsookim committed Oct 28, 2024
commit 788fd06253073894de0ff457b4faad059ac32087
14 changes: 0 additions & 14 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,20 +116,6 @@ def _grid_connectivity(names=list(range(5))):
return _grid_connectivity


@pytest.fixture
def line_connectivity():
def _line_connectivity(n, names=None):
if names is None:
names = list(range(n))
chip = nx.Graph()
chip.add_nodes_from(names)
graph_list = [(names[i], names[i + 1]) for i in range(n - 1)]
chip.add_edges_from(graph_list)
return chip

return _line_connectivity


def pytest_generate_tests(metafunc):
module_name = metafunc.module.__name__

Expand Down
18 changes: 14 additions & 4 deletions tests/test_transpiler_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
)


def line_connectivity(n, names=None):
if names is None:
names = list(range(n))
chip = nx.Graph()
chip.add_nodes_from(names)
graph_list = [(names[i], names[i + 1]) for i in range(n - 1)]
chip.add_edges_from(graph_list)
return chip


def generate_random_circuit(nqubits, ngates, names=None, seed=42):
"""Generate a random circuit with RX and CZ gates."""
np.random.seed(seed)
Expand Down Expand Up @@ -103,7 +113,7 @@ def test_assert_connectivity_3q(star_connectivity):
assert_connectivity(star_connectivity(), circuit)


def test_bell_state_3q(line_connectivity):
def test_bell_state_3q():
from qibo.transpiler.pipeline import _transpose_qubits

circuit = Circuit(3)
Expand Down Expand Up @@ -173,7 +183,7 @@ def test_random_circuits_5q_grid(ngates, placer, grid_connectivity):

@pytest.mark.parametrize("nqubits", [11, 12, 13, 14, 15])
@pytest.mark.parametrize("ngates", [30, 50])
def test_random_circuits_15q_50g(nqubits, ngates, line_connectivity):
def test_random_circuits_15q_50g(nqubits, ngates):
connectivity = line_connectivity(nqubits, None)
placer = Random(connectivity=connectivity)
transpiler = Sabre(connectivity=connectivity)
Expand Down Expand Up @@ -253,7 +263,7 @@ def test_routing_with_measurements(star_connectivity):
)


def test_sabre_looping(line_connectivity):
def test_sabre_looping():
# Setup where the looping occurs
# Line connectivity, gates with gate_array, Trivial placer

Expand Down Expand Up @@ -289,7 +299,7 @@ def test_sabre_looping(line_connectivity):
)


def test_sabre_shortest_path_routing(line_connectivity):
def test_sabre_shortest_path_routing():
gate_array = [(0, 9), (5, 9), (2, 8)] # The gate (2, 8) should be routed next

loop_circ = Circuit(10)
Expand Down
Loading