Skip to content

Commit

Permalink
🎨 adjusted config handling
Browse files Browse the repository at this point in the history
  • Loading branch information
nquetschlich committed Mar 20, 2024
1 parent 476c1ac commit 0d525fe
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/mqt/bench/benchmark_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ class CompilerSettings:


class BenchmarkGenerator:
def __init__(self, cfg_path: str = "./config.json", qasm_output_path: str | None = None) -> None:
def __init__(self, cfg_path: str | None = None, qasm_output_path: str | None = None) -> None:
if cfg_path is None:
cfg_path = utils.get_default_config_path()
with Path(cfg_path).open() as jsonfile:
self.cfg = json.load(jsonfile)
print("Read config successful")
Expand Down Expand Up @@ -453,7 +455,7 @@ def get_benchmark(

def generate(num_jobs: int = -1) -> None:
parser = argparse.ArgumentParser(description="Create Configuration")
parser.add_argument("--file-name", type=str, help="optional filename", default="./config.json")
parser.add_argument("--file-name", type=str, help="optional filename", default=None)
args = parser.parse_args()
benchmark_generator = BenchmarkGenerator(args.file_name)
benchmark_generator.create_benchmarks_from_config(num_jobs)
Expand Down
6 changes: 3 additions & 3 deletions config.json → src/mqt/bench/config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"timeout": 65,
"timeout": 70,
"benchmarks": [
{
"name": "ae",
Expand Down Expand Up @@ -52,15 +52,15 @@
"name": "portfolioqaoa",
"include": true,
"min_qubits": 3,
"max_qubits": 131,
"max_qubits": 14,
"stepsize": 1,
"precheck_possible": true
},
{
"name": "portfoliovqe",
"include": true,
"min_qubits": 3,
"max_qubits": 131,
"max_qubits": 14,
"stepsize": 1,
"precheck_possible": true
},
Expand Down
4 changes: 4 additions & 0 deletions src/mqt/bench/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def get_supported_compilers() -> list[str]:
return ["qiskit", "tket"]


def get_default_config_path() -> str:
return str(resources.files("mqt.bench") / "config.json")


def get_default_qasm_output_path() -> str:
"""Returns the path where all .qasm files are stored."""
return str(resources.files("mqt.benchviewer") / "static" / "files" / "qasm_output")
Expand Down

0 comments on commit 0d525fe

Please sign in to comment.