From 1604506376fecf56b5e92e10686c18c666ba6add Mon Sep 17 00:00:00 2001 From: Nils Quetschlich Date: Sat, 10 Sep 2022 20:35:26 +0200 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=A8=20improved=20filter=20logic=20for?= =?UTF-8?q?=20speed-up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mqt/benchviewer/src/backend.py | 113 +++++++++++++++++---------------- 1 file changed, 57 insertions(+), 56 deletions(-) diff --git a/mqt/benchviewer/src/backend.py b/mqt/benchviewer/src/backend.py index 01eaa8887..fd5cae51b 100644 --- a/mqt/benchviewer/src/backend.py +++ b/mqt/benchviewer/src/backend.py @@ -388,79 +388,80 @@ def filterDatabase(filterCriteria: tuple, database: pd.DataFrame): ), ) = filterCriteria + selected_scalable_benchmarks = [] + selected_nonscalable_benchmarks = [] + for identifier in indices_benchmarks: if int(identifier) > 0 and int(identifier) <= len(benchmarks): name = benchmarks[int(identifier) - 1]["filename"] + selected_scalable_benchmarks.append(name) - db_tmp = database.loc[ - (database["num_qubits"] >= min_qubits) - & (database["num_qubits"] <= max_qubits) - & (database["benchmark"] == name) - ] elif int(identifier) > 0 and int(identifier) <= len(benchmarks) + len( nonscalable_benchmarks ): name = nonscalable_benchmarks[int(identifier) - 1 - len(benchmarks)][ "filename" ] + selected_nonscalable_benchmarks.append(name) - db_tmp = database.loc[database["benchmark"] == name] - else: - print("FAIL") + db_tmp = database.loc[ + ( + (database["num_qubits"] >= min_qubits) + & (database["num_qubits"] <= max_qubits) + & (database["benchmark"].isin(selected_scalable_benchmarks)) + ) + | (database["benchmark"].isin(selected_nonscalable_benchmarks)) + ] - if indep_qiskit_compiler: - db_tmp1 = db_tmp.loc[ - (db_tmp["indep_flag"]) & (db_tmp["compiler"] == "qiskit") - ] - db_filtered = pd.concat([db_filtered, db_tmp1]) + if indep_qiskit_compiler: + db_tmp1 = db_tmp.loc[(db_tmp["indep_flag"]) & (db_tmp["compiler"] == "qiskit")] + db_filtered = pd.concat([db_filtered, db_tmp1]) - if indep_tket_compiler: - db_tmp2 = db_tmp.loc[ - (db_tmp["indep_flag"]) & (db_tmp["compiler"] == "tket") - ] - db_filtered = pd.concat([db_filtered, db_tmp2]) - - if nativegates_qiskit_compiler: - for gate_set in native_gatesets: - for opt_lvl in native_qiskit_opt_lvls: - db_tmp3 = db_tmp.loc[ - (db_tmp["nativegates_flag"]) - & (db_tmp["gate_set"] == gate_set) - & (db_tmp["compiler"] == "qiskit") - & (db_tmp["compiler_settings"] == opt_lvl) - ] - db_filtered = pd.concat([db_filtered, db_tmp3]) - - if nativegates_tket_compiler: - for gate_set in native_gatesets: - db_tmp4 = db_tmp.loc[ + if indep_tket_compiler: + db_tmp2 = db_tmp.loc[(db_tmp["indep_flag"]) & (db_tmp["compiler"] == "tket")] + db_filtered = pd.concat([db_filtered, db_tmp2]) + + if nativegates_qiskit_compiler: + for gate_set in native_gatesets: + for opt_lvl in native_qiskit_opt_lvls: + db_tmp3 = db_tmp.loc[ (db_tmp["nativegates_flag"]) & (db_tmp["gate_set"] == gate_set) + & (db_tmp["compiler"] == "qiskit") + & (db_tmp["compiler_settings"] == opt_lvl) + ] + db_filtered = pd.concat([db_filtered, db_tmp3]) + + if nativegates_tket_compiler: + for gate_set in native_gatesets: + db_tmp4 = db_tmp.loc[ + (db_tmp["nativegates_flag"]) + & (db_tmp["gate_set"] == gate_set) + & (db_tmp["compiler"] == "tket") + ] + db_filtered = pd.concat([db_filtered, db_tmp4]) + + if mapped_qiskit_compiler: + for opt_lvl in mapped_qiskit_opt_lvls: + for device in mapped_devices: + db_tmp5 = db_tmp.loc[ + (db_tmp["mapped_flag"]) + & (db_tmp["target_device"] == device) + & (db_tmp["compiler"] == "qiskit") + & (db_tmp["compiler_settings"] == opt_lvl) + ] + db_filtered = pd.concat([db_filtered, db_tmp5]) + + if mapped_tket_compiler: + for placement in mapped_tket_placements: + for device in mapped_devices: + db_tmp6 = db_tmp.loc[ + (db_tmp["mapped_flag"]) + & (db_tmp["target_device"] == device) & (db_tmp["compiler"] == "tket") + & (db_tmp["compiler_settings"] == placement) ] - db_filtered = pd.concat([db_filtered, db_tmp4]) - - if mapped_qiskit_compiler: - for opt_lvl in mapped_qiskit_opt_lvls: - for device in mapped_devices: - db_tmp5 = db_tmp.loc[ - (db_tmp["mapped_flag"]) - & (db_tmp["target_device"] == device) - & (db_tmp["compiler"] == "qiskit") - & (db_tmp["compiler_settings"] == opt_lvl) - ] - db_filtered = pd.concat([db_filtered, db_tmp5]) - - if mapped_tket_compiler: - for placement in mapped_tket_placements: - for device in mapped_devices: - db_tmp6 = db_tmp.loc[ - (db_tmp["mapped_flag"]) - & (db_tmp["target_device"] == device) - & (db_tmp["compiler"] == "tket") - & (db_tmp["compiler_settings"] == placement) - ] - db_filtered = pd.concat([db_filtered, db_tmp6]) + db_filtered = pd.concat([db_filtered, db_tmp6]) return db_filtered["path"].to_list() From fbd990678dc2af148e9c72d913dd9076e86fb15a Mon Sep 17 00:00:00 2001 From: Nils Quetschlich Date: Sat, 10 Sep 2022 21:09:07 +0200 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=94=96=20increased=20version=20number?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8a5246288..86ee3d285 100644 --- a/setup.py +++ b/setup.py @@ -22,7 +22,7 @@ "mqt.bench.benchmarks.qiskit_application_optimization", "mqt.bench.benchmarks.qiskit_application_nature", ], - version="0.1.2", + version="0.1.3", python_requires=">=3.8", license="MIT", description="MQT Bench - A MQT tool for Benchmarking Quantum Software Tools",