From 0b8e39d0ddb4fb1a837f5280c1211eac11573f0c Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:01:23 -0400 Subject: [PATCH 1/6] Update checkout actions, cut slower bench --- .github/workflows/lint.yml | 12 ++++++------ .github/workflows/nightly_benchmarks.yml | 4 +++- .github/workflows/publish.yml | 2 +- .github/workflows/test_benchmarks.yml | 2 +- qutip_benchmark/benchmarks/bench_solvers.py | 3 ++- qutip_benchmark/cli/run_benchmarks.py | 3 +++ 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 33019f531..a80548f19 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -6,21 +6,21 @@ jobs: lint-black: runs-on: ubuntu-latest steps: - - name: Checkout - uses: "actions/checkout@v2" + - name: Checkout + uses: "actions/checkout@v4" - - name: Setup Python + - name: Setup Python uses: "actions/setup-python@v2" with: python-version: "3.10" - + - name: Black uses: psf/black@stable with: options: "--line-length 79 --check --diff" src: "./qutip_benchmark" - - name: Install dependencies + - name: Install dependencies run: | python -VV python -m site @@ -29,4 +29,4 @@ jobs: python -m pip install flake8-github-actions - name: "Run Flake8" - run: "flake8 qutip_benchmark --format github" \ No newline at end of file + run: "flake8 qutip_benchmark --format github" diff --git a/.github/workflows/nightly_benchmarks.yml b/.github/workflows/nightly_benchmarks.yml index a6c8728f0..4387d29b7 100644 --- a/.github/workflows/nightly_benchmarks.yml +++ b/.github/workflows/nightly_benchmarks.yml @@ -16,8 +16,10 @@ defaults: jobs: benchmarks: + # if: github.repository == 'qutip/qutip-benchmark' name: ${{ matrix.os }}, python${{ matrix.python-version }}, ${{ matrix.case-name }} runs-on: ${{ matrix.os }} + timeout-minutes: 20 strategy: fail-fast: false matrix: @@ -26,7 +28,7 @@ jobs: case-name: [defaults] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v2 with: activate-environment: actions-bench diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e1877fc7d..e9b1b3704 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -21,7 +21,7 @@ jobs: runs-on: ubuntu-latest # if: ${{ github.repository == 'qutip/qutip-benchmark' && github.ref == 'refs/heads/master' }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v2 with: diff --git a/.github/workflows/test_benchmarks.yml b/.github/workflows/test_benchmarks.yml index 242722084..35f9f2878 100644 --- a/.github/workflows/test_benchmarks.yml +++ b/.github/workflows/test_benchmarks.yml @@ -26,7 +26,7 @@ jobs: case-name: [defaults] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: conda-incubator/setup-miniconda@v2 with: activate-environment: actions-bench diff --git a/qutip_benchmark/benchmarks/bench_solvers.py b/qutip_benchmark/benchmarks/bench_solvers.py index 7ab3add3b..4b47d1d84 100644 --- a/qutip_benchmark/benchmarks/bench_solvers.py +++ b/qutip_benchmark/benchmarks/bench_solvers.py @@ -160,7 +160,7 @@ def bench_mcsolve(benchmark, model_solve, size): elif model_solve == "Qubit Spin Chain": H, psi0, c_ops, e_ops = qubit_setup(size) - result = benchmark(mcsolve, H, psi0, tlist, c_ops, e_ops) + result = benchmark(mcsolve, H, psi0, tlist, c_ops, e_ops, ntraj=1) return result @@ -169,6 +169,7 @@ def bench_steadystate(benchmark, model_steady, size): benchmark.group = "solvers:steadystate" if model_steady == "Cavity": + pytest.skipif(size>=128, "Too slow") H, _, c_ops, _ = cavity_setup(size) elif model_steady == "Jaynes-Cummings": diff --git a/qutip_benchmark/cli/run_benchmarks.py b/qutip_benchmark/cli/run_benchmarks.py index a3d274688..e1f7afa6c 100644 --- a/qutip_benchmark/cli/run_benchmarks.py +++ b/qutip_benchmark/cli/run_benchmarks.py @@ -53,6 +53,9 @@ def run_benchmarks(args): "--benchmark-columns=Mean,StdDev,rounds,Iterations", "--benchmark-sort=name", "--benchmark-autosave", + "--benchmark-max_time=3.0", + "--durations=0", + "--durations-min=1.0", "-Wdefault", ] + args From c9aab8273a41dd7a35bc7fc63103cdee7ac49b10 Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:06:07 -0400 Subject: [PATCH 2/6] lint --- qutip_benchmark/benchmarks/bench_solvers.py | 2 +- qutip_benchmark/view_utilities.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/qutip_benchmark/benchmarks/bench_solvers.py b/qutip_benchmark/benchmarks/bench_solvers.py index 4b47d1d84..cf1616649 100644 --- a/qutip_benchmark/benchmarks/bench_solvers.py +++ b/qutip_benchmark/benchmarks/bench_solvers.py @@ -169,7 +169,7 @@ def bench_steadystate(benchmark, model_steady, size): benchmark.group = "solvers:steadystate" if model_steady == "Cavity": - pytest.skipif(size>=128, "Too slow") + pytest.skipif(size >= 128, "Too slow") H, _, c_ops, _ = cavity_setup(size) elif model_steady == "Jaynes-Cummings": diff --git a/qutip_benchmark/view_utilities.py b/qutip_benchmark/view_utilities.py index 8524c7e08..82ea7ba48 100644 --- a/qutip_benchmark/view_utilities.py +++ b/qutip_benchmark/view_utilities.py @@ -465,7 +465,6 @@ def plot_data(data, x_axis, y_axis, x_log, y_log, path): markers = ["o--", "x-", "v:", "1-.", "*:"] i = 0 for plot in data: - line_sep = data[plot]["line_sep"] df = data[plot]["data"] cols = list(df.columns) From c3820023106260c40fc7f2a73cf2eb9f678f45ed Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:07:42 -0400 Subject: [PATCH 3/6] Add benchmarks runs to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 54d8e21e0..73c504858 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ pip-log.txt # Unit test / coverage reports .coverage .tox +.benchmarks nosetests.xml # Translations From 540fff3fdbb0558f502333c3d7d72304b12c657a Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:10:46 -0400 Subject: [PATCH 4/6] Remove time limit try --- qutip_benchmark/cli/run_benchmarks.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qutip_benchmark/cli/run_benchmarks.py b/qutip_benchmark/cli/run_benchmarks.py index e1f7afa6c..7c6756df7 100644 --- a/qutip_benchmark/cli/run_benchmarks.py +++ b/qutip_benchmark/cli/run_benchmarks.py @@ -53,7 +53,6 @@ def run_benchmarks(args): "--benchmark-columns=Mean,StdDev,rounds,Iterations", "--benchmark-sort=name", "--benchmark-autosave", - "--benchmark-max_time=3.0", "--durations=0", "--durations-min=1.0", "-Wdefault", From 51053e8252974923f7787fbc24d29858ed8e14d0 Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:24:07 -0400 Subject: [PATCH 5/6] Skip slow test --- .github/workflows/publish.yml | 2 +- qutip_benchmark/benchmarks/bench_solvers.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e9b1b3704..cd9643eb5 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -19,7 +19,7 @@ defaults: jobs: publish: runs-on: ubuntu-latest - # if: ${{ github.repository == 'qutip/qutip-benchmark' && github.ref == 'refs/heads/master' }} + if: ${{ github.repository == 'qutip/qutip-benchmark' && github.ref == 'refs/heads/master' }} steps: - uses: actions/checkout@v4 diff --git a/qutip_benchmark/benchmarks/bench_solvers.py b/qutip_benchmark/benchmarks/bench_solvers.py index cf1616649..815797ac8 100644 --- a/qutip_benchmark/benchmarks/bench_solvers.py +++ b/qutip_benchmark/benchmarks/bench_solvers.py @@ -169,7 +169,8 @@ def bench_steadystate(benchmark, model_steady, size): benchmark.group = "solvers:steadystate" if model_steady == "Cavity": - pytest.skipif(size >= 128, "Too slow") + if size >= 128: + pytest.skip("Slow test") H, _, c_ops, _ = cavity_setup(size) elif model_steady == "Jaynes-Cummings": From b5fbb9731ac4e845c5d9a3f7275432871edb2482 Mon Sep 17 00:00:00 2001 From: Eric Giguere Date: Tue, 10 Oct 2023 12:56:23 -0400 Subject: [PATCH 6/6] Run nightly on in the main fork --- .github/workflows/nightly_benchmarks.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly_benchmarks.yml b/.github/workflows/nightly_benchmarks.yml index 4387d29b7..3b179521a 100644 --- a/.github/workflows/nightly_benchmarks.yml +++ b/.github/workflows/nightly_benchmarks.yml @@ -16,7 +16,8 @@ defaults: jobs: benchmarks: - # if: github.repository == 'qutip/qutip-benchmark' + # Prevent running in all the forks + if: github.repository == 'qutip/qutip-benchmark' name: ${{ matrix.os }}, python${{ matrix.python-version }}, ${{ matrix.case-name }} runs-on: ${{ matrix.os }} timeout-minutes: 20