Ask HN: How do you run long computations without interruption?
When I spent ten minutes waiting for completion only to see a completely faulty result I started wondering how most scientists and data programmers run long simulations without interruptions or disappointing results. I assume one simple thing I should have done was run a shorter simulation to see if the code was working, but I also started thinking about how I could run a really long simulation without having to worry about the simulation being scrapped after a lot of computation, either because of a runtime error or just a power outage or something.
I know there are cloud services to run expensive computations, but really my question is: are there industry tools or techniques for pause/resume execution of code and simulations? I can't imagine anyone running a simulation for more than ten minutes in a Jupyter cell.
15 comments
[ 3.3 ms ] story [ 49.8 ms ] thread2. Consider setting up another computer on your local network to run your simulation. I often use workflows where to run my program, I execute a makefile that Rsyncs the project directory and runs the program on a remote machine over SSH.
Also, that's pretty clever with the rsync. I presume you have a script that just rsyncs and ssh's an execution. I usually just use git to sync my code across machines.
In my experience, this is often not feasible because it is usually not possible to serialize every object that the program uses. For example, many projects are primarily scripted in a higher level language such as Python and make use of some library written in C++ and the only way to access the C++ objects is through an interface that doesn't expose all of the internal data needed to reconstruct those objects.
I'm not saying that it wouldn't work for you, but this is the type of problem that you might encounter.
BUT, beware that checkpointing can also be unreliable if the system being simulated exhibits chaotic dynamics; truncating off "unimportant" decimal places during checkpointing can produce results that diverge rapidly between the "original" and "restarted from checkpoint" versions.
We try to keep our notebooks slim and factor anything complex into a Python library. We can experiment with this libraries implementation, write unit tests on smaller data sets to confirm it works, before doing a bigger experiment. We can also deploy the library to prod and ensure users get the exact same thing we experimented with.
I would recommend the talk “I don’t like notebooks” https://m.youtube.com/watch?v=7jiPeIFXb6U
(There’s also the alternative nbdev that creates a full software engineering and experimentation setup in 100% notebooks. Not something I particularly like, but it might be another option.)