Skip to content

Commit

Permalink
add print
Browse files Browse the repository at this point in the history
  • Loading branch information
cqc-melf committed Oct 21, 2024
1 parent a0fb01b commit 8fffce7
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/build-docs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ if __name__ == "__main__":
parser.add_argument("-d", "--dest", help="copy artifacts into destination folder")
args = parser.parse_args()

print("Building docs for modules:", MODULE) # noqa: T201
build_module_docs()

if args.dest is not None:
Expand Down
8 changes: 5 additions & 3 deletions pytket/extensions/aqt/backends/aqt_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ def get_devices(self) -> list[AqtDevice]:

def print_device_table(self) -> None:
aqt_provider = AQTProvider(access_token=self._access_token)
aqt_provider.backends()
backend_table = aqt_provider.backends()
print(backend_table) # noqa: T201

def post_aqt_job(self, job: PytketAqtJob, aqt_device: AqtDevice) -> str:
aqt_job = _aqt_job_from_pytket_aqt_job(job)
Expand Down Expand Up @@ -144,7 +145,8 @@ def get_devices(self) -> list[AqtDevice]:
]

def print_device_table(self) -> None:
self._aqt_provider.backends()
backend_table = self._aqt_provider.backends()
print(backend_table) # noqa: T201

def post_aqt_job(self, aqt_job: PytketAqtJob, aqt_device: AqtDevice) -> str:
circuits = [
Expand Down Expand Up @@ -186,7 +188,7 @@ def get_devices(self) -> list[AqtDevice]:
return AQT_MOCK_DEVICES

def print_device_table(self) -> None:
pass
print("Mock device table") # noqa: T201

def post_aqt_job(self, aqt_job: PytketAqtJob, aqt_device: AqtDevice) -> str:
job_id = str(uuid.uuid4())
Expand Down
1 change: 1 addition & 0 deletions pytket/extensions/aqt/backends/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,4 @@ def print_available_devices(access_token: Optional[str] = None) -> None:
backends = aqt_provider.backends()
backends.headers[1] = "Device ID"
backends.headers[3] = "Device type"
print(backends) # noqa: T201
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,9 @@ def get_routed_circuit(self) -> MultiZoneCircuit:
)
for old_place, new_place in self.placement_generator(depth_list):
if self._settings.debug_level > 0:
print("-------") # noqa: T201
for zone in range(self._arch.n_zones):
", ".join(
changes_str = ", ".join(
[
f"+{i}"
for i in set(new_place[zone]).difference(old_place[zone])
Expand All @@ -76,6 +77,10 @@ def get_routed_circuit(self) -> MultiZoneCircuit:
for i in set(old_place[zone]).difference(new_place[zone])
]
)
print( # noqa: T201
f"Z{zone}: {old_place[zone]} ->"
f" {new_place[zone]} -- ({changes_str})"
)
leftovers = []
# stragglers are qubits with pending 2 qubit gates that cannot
# be performed in the old placement
Expand Down Expand Up @@ -178,8 +183,9 @@ def new_placement_graph_partition_alg(
self._settings.n_threads, log_level=self._settings.debug_level
)
if self._settings.debug_level > 0:
print("Depth List:") # noqa: T201
for i in range(min(4, len(depth_list))):
pass
print(depth_list[i]) # noqa: T201
vertex_to_part = partitioner.partition_graph(shuttle_graph_data, num_zones)
new_placement: ZonePlacement = {i: [] for i in range(num_zones)}
part_to_zone = [-1] * num_zones
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def partition_graph(
graph.addFixedVertices(graph_data.fixed_list, num_parts)
part_graph = graph.partition(self.context)
if self.log_level > 0:
pass
print("cut_cost: ", part_graph.cut()) # noqa: T201
vertex_part_id: list[int] = []
for vertex in range(graph_data.n_vertices):
vertex_part_id.append(part_graph.blockID(vertex))
Expand Down
6 changes: 4 additions & 2 deletions tests/multi_zone/compilation_settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def test_compilation_settings_linearch(
initial_placement=initial_pl_settings,
routing=routing_settings,
)
backend.compile_circuit_with_routing(ghz_circuit, compilation_settings)
compiled = backend.compile_circuit_with_routing(ghz_circuit, compilation_settings)
print("Shuttles: ", compiled.get_n_shuttles()) # noqa: T201


mtkahypar_skipif = pytest.mark.skipif(
Expand Down Expand Up @@ -167,4 +168,5 @@ def test_compilation_settings_gridarch(
initial_placement=initial_pl_settings,
routing=routing_settings,
)
backend.compile_circuit_with_routing(ghz_circuit, compilation_settings)
compiled = backend.compile_circuit_with_routing(ghz_circuit, compilation_settings)
print("Shuttles: ", compiled.get_n_shuttles()) # noqa: T201

0 comments on commit 8fffce7

Please sign in to comment.