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

Feature request: simulation timeout run function #850

Closed
smartalecH opened this issue May 2, 2019 · 1 comment · Fixed by #860
Closed

Feature request: simulation timeout run function #850

smartalecH opened this issue May 2, 2019 · 1 comment · Fixed by #860

Comments

@smartalecH
Copy link
Collaborator

It would be nice to incorporate a run function that stops the simulation after a specified time interval (actual time, not MEEP time) has passed.

This would be especially useful for jobs that are submitted to clusters with designated walltimes. The user could pass the walltime to the MEEP solver so that any progress could be saved before the job scheduler kills the job.

I'm thinking of something similar to the opt.set_maxtime(maxtime) within nlopt's API.

@stevengj
Copy link
Collaborator

stevengj commented May 2, 2019

It would certainly be possible to have a stop_after_walltime(t) function that you could pass to run. (You could even write such a step function yourself — it doesn't require any Meep internals.)

Another possibility we have discussed is to have a stop_on_interrupt function that you can pass to run, which will catch SIGTERM or SIGINT (ctrl-c) and stop the simulation, executing any code that you have following the run (e.g. code to output fields or whatever).

(Both of these would be fine to implement in Python — the performance cost of checking the time or checking a flag to see if a signal handler has been called is negligible compared to the cost of a timestep.)

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