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

Allow resuming simulation by regularly saving to file #5

Merged
merged 1 commit into from
Jan 21, 2025
Merged

Conversation

pablolh
Copy link
Contributor

@pablolh pablolh commented Jan 13, 2025

  • Adds autosave_prefix and autosave_dt config fields
    By default:
    emu_mps_save_<uuid>.dat
    every 10 minute
  • Accidentally fix the various config entries and
    carry the whole MPSConfig along. It was part of my
    research for optimal implementation and takes too
    much time to separate as a independent MR.
  • Some fixes to the unpickled impl are necessary,
    like autosave_file (to save to same existing file)
    and the logger which gets messed up by the pickling.
  • Fix make_H modifying its interaction_matrix argument.
    That was also part of the process but in fact now
    unrelated.

---> How to resume a simulation from a file

import emu_mps
results = emu_mps.MPSBackend().resume("emu_mps_save_xxx.dat")

@pablolh pablolh force-pushed the plh/autosave branch 4 times, most recently from 3646427 to a5c6145 Compare January 15, 2025 13:27
@pablolh pablolh marked this pull request as ready for review January 15, 2025 13:29
@pablolh pablolh changed the title WIP: Allow resuming simulation by regularly saving to file Allow resuming simulation by regularly saving to file Jan 15, 2025
@murogrande
Copy link
Contributor

  • is this autosave going to work also with the noise ?

@pablolh
Copy link
Contributor Author

pablolh commented Jan 15, 2025

is this autosave going to work also with the noise ?

It is designed to work with all sorts of noise. I tried it in a bunch of cases, notably the noisy benchmarks were tested for same plots after the previous MR.
Of course I cannot guarantee it is 100% bug-free but I haven't discovered an issue so far.

@murogrande
Copy link
Contributor

is this autosave going to work also with the noise ?

It is designed to work with all sorts of noise. I tried it in a bunch of cases, notably the noisy benchmarks were tested for same plots after the previous MR. Of course I cannot guarantee it is 100% bug-free but I haven't discovered an issue so far.

In this case, then where is stored the number of runs of the monte carlo and in which run the code is actually running? or how is the code managing this situation?

emu_mps/mps_config.py Outdated Show resolved Hide resolved
@a-quelle
Copy link
Collaborator

is this autosave going to work also with the noise ?

It is designed to work with all sorts of noise. I tried it in a bunch of cases, notably the noisy benchmarks were tested for same plots after the previous MR. Of course I cannot guarantee it is 100% bug-free but I haven't discovered an issue so far.

In this case, then where is stored the number of runs of the monte carlo and in which run the code is actually running? or how is the code managing this situation?

Having several runs for Monte Carlo in one go was something we supported in emu-tn, but here it assumes a single run. If you want to have several runs, you need to write your own code to do it. This code allows you to checkpoint an individual run. You could build a checkpointing system for many runs out of this.

@pablolh
Copy link
Contributor Author

pablolh commented Jan 21, 2025

fixed the logging and default autosave time interval

- Adds autosave_prefix and autosave_dt config fields
	By default:
		emu_mps_save_<uuid>.dat
		every 10 minute
- Accidentally fix the various config entries and
carry the whole MPSConfig along. It was part of my
research for optimal implementation and takes too
much time to separate as a independent MR.
- Some fixes to the unpickled impl are necessary,
like autosave_file (to save to same existing file)
and the logger which gets messed up by the pickling.
- Fix make_H modifying its interaction_matrix argument.
That was also part of the process but in fact now
unrelated.

---> How to resume a simulation from a file

import emu_mps
results = emu_mps.MPSBackend().resume("emu_mps_save_xxx.dat")
Copy link
Collaborator

@a-quelle a-quelle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pablolh pablolh merged commit caa1cb7 into main Jan 21, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants