Skip to content

Commit

Permalink
reformat code
Browse files Browse the repository at this point in the history
  • Loading branch information
Coull committed Nov 26, 2024
1 parent 75913da commit 7bb5014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
22 changes: 5 additions & 17 deletions benchmark/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@ def test_exact_shots(benchmark, device_id, nq, exact_results, circuit):
exact_results in ("state_vector",) or nq > 10
):
pytest.skip()
if (
device_id in ("braket_sv",)
and exact_results in ("density_matrix q[0], q[1]",)
and nq >= 17
):
if device_id in ("braket_sv",) and exact_results in ("density_matrix q[0], q[1]",) and nq >= 17:
pytest.skip()
result_type = exact_results
oq3_prog = Program(source=circuit(nq, result_type))
Expand All @@ -86,9 +82,7 @@ def test_exact_shots(benchmark, device_id, nq, exact_results, circuit):
@pytest.mark.parametrize("batch_size", batch_size)
@pytest.mark.parametrize("exact_results", exact_shots_results)
@pytest.mark.parametrize("circuit", generators)
def test_exact_shots_batched(
benchmark, device_id, nq, batch_size, exact_results, circuit
):
def test_exact_shots_batched(benchmark, device_id, nq, batch_size, exact_results, circuit):
if device_id in ("braket_dm_v2", "braket_dm") and (
exact_results in ("state_vector,") or nq >= 5
):
Expand All @@ -100,9 +94,7 @@ def test_exact_shots_batched(
result_type = exact_results
oq3_prog = [Program(source=circuit(nq, result_type)) for _ in range(batch_size)]
sim = LocalSimulator(device_id)
benchmark.pedantic(
run_sim_batch, args=(oq3_prog, sim, 0), iterations=5, warmup_rounds=1
)
benchmark.pedantic(run_sim_batch, args=(oq3_prog, sim, 0), iterations=5, warmup_rounds=1)


shots = (100,)
Expand All @@ -119,9 +111,7 @@ def test_nonzero_shots(benchmark, device_id, nq, shots, nonzero_shots_results, c
result_type = nonzero_shots_results
oq3_prog = Program(source=circuit(nq, result_type))
sim = LocalSimulator(device_id)
benchmark.pedantic(
run_sim, args=(oq3_prog, sim, shots), iterations=5, warmup_rounds=1
)
benchmark.pedantic(run_sim, args=(oq3_prog, sim, shots), iterations=5, warmup_rounds=1)
del sim


Expand All @@ -145,7 +135,5 @@ def test_nonzero_shots_batched(
result_type = nonzero_shots_results
oq3_prog = [Program(source=circuit(nq, result_type)) for _ in range(batch_size)]
sim = LocalSimulator(device_id)
benchmark.pedantic(
run_sim_batch, args=(oq3_prog, sim, shots), iterations=5, warmup_rounds=1
)
benchmark.pedantic(run_sim_batch, args=(oq3_prog, sim, shots), iterations=5, warmup_rounds=1)
del sim
2 changes: 1 addition & 1 deletion src/braket/simulator_v2/base_simulator_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def setup_julia() -> None:
os.environ[k] = os.environ.get(k, default)

import juliacall # noqa: PLC0415

jl = juliacall.Main
jl.seval("using BraketSimulator, JSON3")
stock_oq3 = """
Expand Down

0 comments on commit 7bb5014

Please sign in to comment.