interruptible computation
Nov. 23rd, 2008 12:11 amRight now, I have some Matlab code running, which has been going for 10 minutes. It's in a loop, iterating over many values of a parameter i. Since I didn't think of putting prints, I can't tell how far along it is.
I'd like to interrupt it, query the value of i, and tell it go back, wasting at most one iteration's worth of work. It's not asking much, since it's easy to make another loop starting at the interrupted value of i and going until the end.
Unfortunately, I'd have to do this by hand.
I'd like to interrupt it, query the value of i, and tell it go back, wasting at most one iteration's worth of work. It's not asking much, since it's easy to make another loop starting at the interrupted value of i and going until the end.
Unfortunately, I'd have to do this by hand.
(no subject)
Date: 2008-11-23 08:20 am (UTC)(no subject)
Date: 2008-11-23 09:54 am (UTC)(no subject)
Date: 2008-11-23 06:51 pm (UTC)(no subject)
Date: 2008-11-23 09:27 am (UTC)(no subject)
Date: 2008-11-23 09:54 am (UTC)This involves concurrent programming. Overkill.
Yes, of course you can make it log. The point is that it's usually too late by the time you notice it.
What I'm saying is there's no reason for the language require the execution be uninterruptible. As
(no subject)
Date: 2008-11-23 10:14 am (UTC)(no subject)
Date: 2008-11-23 10:29 am (UTC)(no subject)
Date: 2008-11-23 12:37 pm (UTC)So here is what else you can do:
Within your loop, test for the existence of a file. If it's there, call keyboard. This gives you a debug prompt you can resume from with dbcont.
Or, within your loop, save your state to a .mat file with save. Start a second MATLAB and load the .mat file, inspect, etc.
(no subject)
Date: 2008-11-23 12:52 pm (UTC)(no subject)
Date: 2008-11-23 01:59 pm (UTC)where k is smaller than N and N is divisible by k multiple times at least.