Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Simulation Abort Capability. #117

Closed
capn-freako opened this issue Dec 11, 2022 · 1 comment · Fixed by #127
Closed

Add Simulation Abort Capability. #117

capn-freako opened this issue Dec 11, 2022 · 1 comment · Fixed by #127
Assignees

Comments

@capn-freako
Copy link
Owner

Describe the desired new or improved feature.
While we're currently able to abort an optimization, we aren't able to abort a simulation.
We should have this capability, to handle, for instance:

  • when the user launches a simulation having mistyped the number of bits she wants to run.

Expected behavior
An item in the Simulation menu, which aborts the currently running simulation when selected.
Also, a keyboard shortcut for this menu item.

Screenshots
(n/a)

Desktop (please complete the following information):

  • OS: (all)
  • Python Version (all)
  • PyBERT Version (next release)

Additional context
(n/a)

@jdpatt
Copy link
Collaborator

jdpatt commented Apr 21, 2023

This will force us to breakout down our my_run_sweep to check that the thread is still alive and should it continue since today the thread just calls one function and returns.

    def run(self):
        """Run the simulation(s)."""
        my_run_sweeps(self.the_pybert)

Comparing that to the optimization threads that run an iteration of minimization and then check if it should stop or not.

                res = minimize(
                    self.do_opt_tx,
                    old_taps,
                    bounds=bounds,
                    constraints=cons,
                    options={"disp": False, "maxiter": max_iter},
                )

   ...

    def do_opt_tx(self, taps):
        """Run the Tx Optimization."""
        sleep(0.001)  # Give the GUI a chance to acknowledge user clicking the Abort button.

        if self.stopped():
            raise RuntimeError("Optimization aborted.")

        pybert = self.pybert
        tuners = pybert.tx_tap_tuners
        taps = list(taps)
        for tuner in tuners:
            if tuner.enabled:
                tuner.value = taps.pop(0)
        return pybert.cost

This will tie nicely into #119. We can pull apart my_run_sweep and then have the correct solver get created for time or statistical simulation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants