iqm-benchmarks 2.41__py3-none-any.whl → 2.42__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -422,9 +422,6 @@ def qscore_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
422
422
  beta_ratio_list = []
423
423
  beta_ratio_std_list = []
424
424
  for num_nodes in nodes_list:
425
- # Retrieve counts for all the instances within each executed node size.
426
- execution_results = xrvariable_to_counts(dataset, num_nodes, num_instances)
427
-
428
425
  # Retrieve other dataset values
429
426
  dataset_dictionary = dataset.attrs[num_nodes]
430
427
 
@@ -433,18 +430,21 @@ def qscore_analysis(run: BenchmarkRunResult) -> BenchmarkAnalysisResult:
433
430
  qubit_to_node_list = dataset_dictionary["qubit_to_node"]
434
431
  virtual_node_list = dataset_dictionary["virtual_nodes"]
435
432
  no_edge_instances = dataset_dictionary["no_edge_instances"]
436
-
437
433
  cut_sizes_list = [0.0] * len(no_edge_instances)
434
+
435
+ # Retrieve counts for all the instances within each executed node size.
438
436
  instances_with_edges = set(range(num_instances)) - set(no_edge_instances)
437
+ num_instances_with_edges = len(instances_with_edges)
438
+ execution_results = xrvariable_to_counts(dataset, num_nodes, num_instances_with_edges)
439
439
 
440
- for inst_idx in list(instances_with_edges):
440
+ for inst_idx, instance in enumerate(list(instances_with_edges)):
441
441
  cut_sizes = run_QAOA(
442
442
  execution_results[inst_idx],
443
- graph_list[inst_idx],
444
- qubit_to_node_list[inst_idx],
443
+ graph_list[instance],
444
+ qubit_to_node_list[instance],
445
445
  use_classically_optimized_angles,
446
446
  num_qaoa_layers,
447
- virtual_node_list[inst_idx],
447
+ virtual_node_list[instance],
448
448
  )
449
449
  cut_sizes_list.append(cut_sizes)
450
450
 
@@ -770,7 +770,7 @@ class QScoreBenchmark(Benchmark):
770
770
  for num_nodes in node_numbers:
771
771
  qc_list = []
772
772
  qc_transpiled_list: List[QuantumCircuit] = []
773
- execution_results = []
773
+ execution_results: List[Dict[str, int]] = []
774
774
  graph_list = []
775
775
  qubit_set_list = []
776
776
  theta_list = []
@@ -789,6 +789,7 @@ class QScoreBenchmark(Benchmark):
789
789
  virtual_node_list = []
790
790
  qubit_to_node_list = []
791
791
  no_edge_instances = []
792
+ qc_all = [] # all circuits, including those with no edges
792
793
  for instance in range(self.num_instances):
793
794
  qcvv_logger.debug(f"Executing graph {instance} with {num_nodes} nodes.")
794
795
  graph = nx.generators.erdos_renyi_graph(num_nodes, 0.5, seed=seed)
@@ -839,69 +840,64 @@ class QScoreBenchmark(Benchmark):
839
840
  theta_list.append(theta)
840
841
 
841
842
  qc = self.generate_maxcut_ansatz(graph, theta)
842
- qc_list.append(qc)
843
- qubit_to_node_copy = self.qubit_to_node.copy()
844
- qubit_to_node_list.append(qubit_to_node_copy)
845
-
846
- if len(qc.count_ops()) == 0:
847
- counts = {"": 1.0} # to handle the case of physical graph with no edges
848
- qc_transpiled_list.append([])
849
- execution_results.append(counts)
850
- qc_list.append([])
851
- qcvv_logger.debug(f"This graph instance has no edges.")
852
- else:
853
- qcvv_logger.setLevel(logging.WARNING)
854
- # Account for all-to-all connected backends like Sirius
855
- if "move" in backend.architecture.gates:
856
- # If the circuit is defined on a subset of qubit_set, choose the first qubtis in the set
857
- active_qubit_set = qubit_set[: len(qc.qubits)]
858
- # All-to-all coupling map on the active qubits
859
- effective_coupling_map = [[x, y] for x in active_qubit_set for y in active_qubit_set if x != y]
860
- else:
861
- if self.choose_qubits_routine == "naive":
862
- active_qubit_set = None
863
- effective_coupling_map = self.backend.coupling_map
864
- else:
865
- active_qubit_set = qubit_set
866
- effective_coupling_map = self.backend.coupling_map.reduce(active_qubit_set)
867
-
868
- transpilation_params = {
869
- "backend": self.backend,
870
- "qubits": active_qubit_set,
871
- "coupling_map": effective_coupling_map,
872
- "qiskit_optim_level": self.qiskit_optim_level,
873
- "optimize_sqg": self.optimize_sqg,
874
- "routing_method": self.routing_method,
875
- }
876
843
 
877
- transpiled_qc, _ = perform_backend_transpilation([qc], **transpilation_params)
878
-
879
- sorted_transpiled_qc_list = {tuple(qubit_set): transpiled_qc}
880
- # Execute on the backend
881
- jobs, _ = submit_execute(
882
- sorted_transpiled_qc_list,
883
- self.backend,
884
- self.shots,
885
- self.calset_id,
886
- max_gates_per_batch=self.max_gates_per_batch,
887
- max_circuits_per_batch=self.configuration.max_circuits_per_batch,
888
- circuit_compilation_options=self.circuit_compilation_options,
889
- )
890
- qc_transpiled_list.append(transpiled_qc)
891
- qcvv_logger.setLevel(logging.INFO)
892
-
893
- if self.REM:
894
- rem_counts = apply_readout_error_mitigation(
895
- backend, transpiled_qc, [retrieve_all_counts(jobs)[0][0]], self.mit_shots
896
- )
897
- rem_distribution = rem_counts[0][0].nearest_probability_distribution()
898
- execution_results.append(rem_distribution)
899
- else:
900
- execution_results.append(retrieve_all_counts(jobs)[0][0])
844
+ if len(qc.count_ops()) != 0:
845
+ qc_list.append(qc)
846
+ qc_all.append(qc)
847
+ qubit_to_node_copy = self.qubit_to_node.copy()
848
+ qubit_to_node_list.append(qubit_to_node_copy)
849
+ else:
850
+ qc_all.append([])
901
851
 
902
852
  seed += 1
903
853
  qcvv_logger.debug(f"Solved the MaxCut on graph {instance+1}/{self.num_instances}.")
904
854
 
855
+ qcvv_logger.setLevel(logging.WARNING)
856
+ if self.choose_qubits_routine == "naive":
857
+ active_qubit_set = None
858
+ effective_coupling_map = self.backend.coupling_map
859
+ else:
860
+ active_qubit_set = qubit_set
861
+ effective_coupling_map = self.backend.coupling_map.reduce(active_qubit_set)
862
+
863
+ transpilation_params = {
864
+ "backend": self.backend,
865
+ "qubits": active_qubit_set,
866
+ "coupling_map": effective_coupling_map,
867
+ "qiskit_optim_level": self.qiskit_optim_level,
868
+ "optimize_sqg": self.optimize_sqg,
869
+ "routing_method": self.routing_method,
870
+ }
871
+
872
+ transpiled_qc, _ = perform_backend_transpilation(qc_list, **transpilation_params)
873
+
874
+ sorted_transpiled_qc_list = {tuple(qubit_set): transpiled_qc}
875
+ # Execute on the backend
876
+ jobs, _ = submit_execute(
877
+ sorted_transpiled_qc_list,
878
+ self.backend,
879
+ self.shots,
880
+ self.calset_id,
881
+ max_gates_per_batch=self.max_gates_per_batch,
882
+ max_circuits_per_batch=self.configuration.max_circuits_per_batch,
883
+ circuit_compilation_options=self.circuit_compilation_options,
884
+ )
885
+ qc_transpiled_list.append(transpiled_qc)
886
+ qcvv_logger.setLevel(logging.INFO)
887
+ instance_with_edges = set(range(self.num_instances)) - set(no_edge_instances)
888
+ num_instances_with_edges = len(instance_with_edges)
889
+ if self.REM:
890
+ rem_counts = apply_readout_error_mitigation(
891
+ backend, transpiled_qc, retrieve_all_counts(jobs)[0], self.mit_shots
892
+ )
893
+ execution_results.extend(
894
+ rem_counts[0][instance].nearest_probability_distribution()
895
+ for instance in range(num_instances_with_edges)
896
+ )
897
+ # execution_results.append(rem_distribution)
898
+ else:
899
+ execution_results.extend(retrieve_all_counts(jobs)[0])
900
+
905
901
  dataset.attrs.update(
906
902
  {
907
903
  num_nodes: {
@@ -918,10 +914,7 @@ class QScoreBenchmark(Benchmark):
918
914
 
919
915
  qcvv_logger.debug(f"Adding counts for the random graph for {num_nodes} nodes to the dataset")
920
916
  dataset, _ = add_counts_to_dataset(execution_results, str(num_nodes), dataset)
921
-
922
- # self.untranspiled_circuits[str(num_nodes)].update({tuple(qubit_set): qc_list})
923
- # self.transpiled_circuits[str(num_nodes)].update(sorted_transpiled_qc_list)
924
- self.untranspiled_circuits.circuit_groups.append(CircuitGroup(name=str(num_nodes), circuits=qc_list))
917
+ self.untranspiled_circuits.circuit_groups.append(CircuitGroup(name=str(num_nodes), circuits=qc_all))
925
918
  self.transpiled_circuits.circuit_groups.append(
926
919
  CircuitGroup(name=str(num_nodes), circuits=qc_transpiled_list)
927
920
  )
iqm/benchmarks/utils.py CHANGED
@@ -567,35 +567,31 @@ def perform_backend_transpilation(
567
567
  # Helper function considering whether optimize_sqg is done,
568
568
  # and whether the coupling map is reduced (whether final physical layout must be fixed onto an auxiliary QC)
569
569
  def transpile_and_optimize(qc, aux_qc=None):
570
- transpiled = transpile(
571
- qc,
572
- basis_gates=basis_gates,
573
- coupling_map=coupling_map,
574
- optimization_level=qiskit_optim_level,
575
- initial_layout=qubits if aux_qc is None else None,
576
- routing_method=routing_method,
577
- )
578
- if optimize_sqg:
579
- transpiled = optimize_single_qubit_gates(transpiled, drop_final_rz=drop_final_rz)
580
570
  if backend.has_resonators():
571
+ coupling_map_red = (
572
+ backend.coupling_map.reduce(qubits[: qc.num_qubits]) if aux_qc is not None else coupling_map
573
+ )
581
574
  transpiled = transpile_to_IQM(
582
- qc, backend=backend, optimize_single_qubits=optimize_sqg, remove_final_rzs=drop_final_rz
575
+ qc,
576
+ backend=backend,
577
+ optimize_single_qubits=optimize_sqg,
578
+ remove_final_rzs=drop_final_rz,
579
+ coupling_map=coupling_map_red,
580
+ # initial_layout=qubits if aux_qc is None else None,
583
581
  )
584
- if aux_qc is not None:
585
- if backend.has_resonators():
586
- if backend.num_qubits in qubits:
587
- raise ValueError(
588
- f"Label {backend.num_qubits} is reserved for Resonator - "
589
- f"Please specify computational qubit labels {np.arange(backend.num_qubits)}"
590
- )
591
- backend_topology = "star"
592
- transpiled = reduce_to_active_qubits(transpiled, backend_topology, backend.num_qubits)
593
- transpiled = aux_qc.compose(
594
- transpiled, qubits=qubits + [backend.num_qubits], clbits=list(range(qc.num_clbits))
595
- )
596
- else:
582
+ else:
583
+ transpiled = transpile(
584
+ qc,
585
+ basis_gates=basis_gates,
586
+ coupling_map=coupling_map,
587
+ optimization_level=qiskit_optim_level,
588
+ initial_layout=qubits if aux_qc is None else None,
589
+ routing_method=routing_method,
590
+ )
591
+ if aux_qc is not None:
597
592
  transpiled = aux_qc.compose(transpiled, qubits=qubits, clbits=list(range(qc.num_clbits)))
598
-
593
+ if optimize_sqg:
594
+ transpiled = optimize_single_qubit_gates(transpiled, drop_final_rz=drop_final_rz)
599
595
  return transpiled
600
596
 
601
597
  qcvv_logger.info(
@@ -607,7 +603,7 @@ def perform_backend_transpilation(
607
603
  transpiled_qc_list = [transpile_and_optimize(qc) for qc in qc_list]
608
604
  else: # The coupling map will be reduced if the physical layout is to be fixed
609
605
  if backend.has_resonators():
610
- aux_qc_list = [QuantumCircuit(backend.num_qubits + 1, q.num_clbits) for q in qc_list]
606
+ aux_qc_list = [QuantumCircuit(backend.num_qubits, q.num_clbits) for q in qc_list]
611
607
  else:
612
608
  aux_qc_list = [QuantumCircuit(backend.num_qubits, q.num_clbits) for q in qc_list]
613
609
  transpiled_qc_list = [transpile_and_optimize(qc, aux_qc=aux_qc_list[idx]) for idx, qc in enumerate(qc_list)]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: iqm-benchmarks
3
- Version: 2.41
3
+ Version: 2.42
4
4
  Summary: A package for implementation of Quantum Characterization, Verification and Validation (QCVV) techniques on IQM's hardware at gate level abstraction
5
5
  Author-email: IQM Finland Oy <developers@meetiqm.com>, Adrian Auer <adrian.auer@meetiqm.com>, Raphael Brieger <raphael.brieger@meetiqm.com>, Alessio Calzona <alessio.calzona@meetiqm.com>, Pedro Figueroa Romero <pedro.romero@meetiqm.com>, Amin Hosseinkhani <amin.hosseinkhani@meetiqm.com>, Miikka Koistinen <miikka@meetiqm.com>, Nadia Milazzo <nadia.milazzo@meetiqm.com>, Vicente Pina Canelles <vicente.pina@meetiqm.com>, Aniket Rath <aniket.rath@meetiqm.com>, Jami Rönkkö <jami@meetiqm.com>, Stefan Seegerer <stefan.seegerer@meetiqm.com>
6
6
  Project-URL: Homepage, https://github.com/iqm-finland/iqm-benchmarks
@@ -4,7 +4,7 @@ iqm/benchmarks/benchmark_definition.py,sha256=e4xe0wlWKZqj48_6-zTglMaMeoiA9aGkHr
4
4
  iqm/benchmarks/circuit_containers.py,sha256=anEtZEsodYqOX-34oZRmuKGeEpp_VfgG5045Mz4-4hI,7562
5
5
  iqm/benchmarks/logging_config.py,sha256=U7olP5Kr75AcLJqNODf9VBhJLVqIvA4AYR6J39D5rww,1052
6
6
  iqm/benchmarks/readout_mitigation.py,sha256=Q2SOGWTNgmklOYkNxepAaSaXlxSj0QQyymYY1bOkT8A,11756
7
- iqm/benchmarks/utils.py,sha256=HUiLUBwlYwQbQivcswRLkSZuSwhXmroxiu9MMnxcnNI,41381
7
+ iqm/benchmarks/utils.py,sha256=sItoMsfUYiMWTSCNOTe_RWi2l1xTf2slvXkFiEMRwKU,41091
8
8
  iqm/benchmarks/utils_plots.py,sha256=Q4h7gcKXf8Eizm13P0yL2I_P-QobHVFr9JCV83wrUi8,14942
9
9
  iqm/benchmarks/utils_shadows.py,sha256=e77PV_uaAO5m_woox9lAzompKAvFeDJ-0AKJrNJ7NFg,9728
10
10
  iqm/benchmarks/compressive_gst/__init__.py,sha256=LneifgYXtcwo2jcXo7GdUEHL6_peipukShhkrdaTRCA,929
@@ -14,7 +14,7 @@ iqm/benchmarks/entanglement/__init__.py,sha256=sHVVToRWRCz0LSntk1rQaoSNNeyZLPoiT
14
14
  iqm/benchmarks/entanglement/ghz.py,sha256=12bf9ANfgzyR7Vs8REO-Xm68gisqn8Q7_WSfaNnAmOk,41213
15
15
  iqm/benchmarks/entanglement/graph_states.py,sha256=7GMxuhbOeQXc3hn3yAwp51S-F-1qaP0AYXm6JtuL9gA,62560
16
16
  iqm/benchmarks/optimization/__init__.py,sha256=_ajW_OibYLCtzU5AUv5c2zuuVYn8ZNeZUcUUSIGt51M,747
17
- iqm/benchmarks/optimization/qscore.py,sha256=C7_Vaj_JnjipBJacaa-rhH70Wgct3y1uzPMurZ4wPco,38068
17
+ iqm/benchmarks/optimization/qscore.py,sha256=D2BVVNAqO32uGu5_kLVl2XJUOBlRl1C-c6zYenaCBMg,37259
18
18
  iqm/benchmarks/quantum_volume/__init__.py,sha256=i-Q4SpDWELBw7frXnxm1j4wJRcxbIyrS5uEK_v06YHo,951
19
19
  iqm/benchmarks/quantum_volume/clops.py,sha256=fLY0aPHjNbW33SuVM9brAgBYFncDHjY5Bwh6iXzbjiU,31099
20
20
  iqm/benchmarks/quantum_volume/quantum_volume.py,sha256=pro7Lz-A5pPpT9UZ8wtXKTyhdWmTjQjRHt4BylDR-3U,36553
@@ -33,7 +33,7 @@ iqm/benchmarks/randomized_benchmarking/interleaved_rb/__init__.py,sha256=sq6MgN_
33
33
  iqm/benchmarks/randomized_benchmarking/interleaved_rb/interleaved_rb.py,sha256=TaR1YFWBhOgm1hmEQzuwLYpp0yl0Xpuo3jAT6YhiXpc,28471
34
34
  iqm/benchmarks/randomized_benchmarking/mirror_rb/__init__.py,sha256=jRKbivWCZ3xdO1k0sx-ygC3s5DUkGSModd975PoAtcg,692
35
35
  iqm/benchmarks/randomized_benchmarking/mirror_rb/mirror_rb.py,sha256=n_5gt9636ZDMsM9hC3Zm5qP2bQr2sy41zxGhOh0XMjI,32932
36
- iqm_benchmarks-2.41.dist-info/licenses/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
36
+ iqm_benchmarks-2.42.dist-info/licenses/LICENSE,sha256=2Ncb40-hqkTil78RPv3-YiJfKaJ8te9USJgliKqIdSY,11558
37
37
  mGST/LICENSE,sha256=TtHNq55cUcbglb7uhVudeBLUh_qPdUoAEvU0BBwFz-k,1098
38
38
  mGST/README.md,sha256=v_5kw253csHF4-RfE-44KqFmBXIsSMRmOtN0AUPrRxE,5050
39
39
  mGST/additional_fns.py,sha256=_SEJ10FRNM7_CroysT8hCLZTfpm6ZhEIDCY5zPTnhjo,31390
@@ -44,7 +44,7 @@ mGST/optimization.py,sha256=YHwkzIkYvsZOPjclR-BCQWh24jeqjuXp0BB0WX5Lwow,10559
44
44
  mGST/qiskit_interface.py,sha256=ajx6Zn5FnrX_T7tMP8xnBLyG4c2ddFRm0Fu2_3r1t30,10118
45
45
  mGST/reporting/figure_gen.py,sha256=6Xd8vwfy09hLY1YbJY6TRevuMsQSU4MsWqemly3ZO0I,12970
46
46
  mGST/reporting/reporting.py,sha256=B8NWfpZrrSmyH7lwZxd0EbZMYLsAGK1YsHRB4D5qXH4,26002
47
- iqm_benchmarks-2.41.dist-info/METADATA,sha256=dhrtXPKZVscHp004aaBgn50XtkkakMKYT2wswyxZYfU,10872
48
- iqm_benchmarks-2.41.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
- iqm_benchmarks-2.41.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
50
- iqm_benchmarks-2.41.dist-info/RECORD,,
47
+ iqm_benchmarks-2.42.dist-info/METADATA,sha256=JBIVb_IKpTjclpuMILV4Gmo3nZhs3FhwU5vsOtTjLPc,10872
48
+ iqm_benchmarks-2.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
49
+ iqm_benchmarks-2.42.dist-info/top_level.txt,sha256=3G23Z-1LGf-IOzTCUl6QwWqiQ3USz25Zt90Ihq192to,9
50
+ iqm_benchmarks-2.42.dist-info/RECORD,,