Project memory being erased without a restart?

36 views
Skip to first unread message

saad khalid

unread,
Sep 23, 2016, 9:21:21 PM9/23/16
to sage-cloud
Hello everyone:

I'm running a computation that takes a long time to finish, so I don't want to do it more than one. I ran it once this morning and it finished and it was saved in the RAM and I could read it. But, by later in the day, it was deleted somehow. It's possible that someone else restarted the project, and I've told everyone to not do that for a few days. But, I just wanted to check, is there any other mechanism through which the memory might be deleted that I don't know about? If there is, is there some way I can save the results of the computation so that even if the project restarts or the ram refreshes or something, I don't lose everything that's been computed? Thanks!


David Roe

unread,
Sep 24, 2016, 12:12:12 AM9/24/16
to sage-cloud
This happened to me yesterday, and I then realized that I hadn't increased the timeout quota enough (some of my quota was allocated to other projects).  My fault.  :-/

The best thing to do is save the results to a file.  Then you won't lose them if the project restarts.
David

On Fri, Sep 23, 2016 at 9:21 PM, saad khalid <saad...@gmail.com> wrote:
Hello everyone:

I'm running a computation that takes a long time to finish, so I don't want to do it more than one. I ran it once this morning and it finished and it was saved in the RAM and I could read it. But, by later in the day, it was deleted somehow. It's possible that someone else restarted the project, and I've told everyone to not do that for a few days. But, I just wanted to check, is there any other mechanism through which the memory might be deleted that I don't know about? If there is, is there some way I can save the results of the computation so that even if the project restarts or the ram refreshes or something, I don't lose everything that's been computed? Thanks!


--
You received this message because you are subscribed to the Google Groups "sage-cloud" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-cloud+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sage-cloud/33440c7a-adc9-443d-807d-4288294fa354%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Harald Schilly

unread,
Sep 24, 2016, 4:24:23 AM9/24/16
to sage-cloud
On Sat, Sep 24, 2016 at 3:21 AM, saad khalid <saad...@gmail.com> wrote:
> I'm running a computation that takes a long time to finish, so I don't want
> to do it more than one. I ran it once this morning and it finished and it
> was saved in the RAM and I could read it. But, by later in the day, it was
> deleted somehow...

Hello, there are many reasons why your processes can stop, and they
range from a bug in the code, timeout of the project's idle time, a
technical problem, or a general issue with the compute node and it has
to reboot. What you have to implement is a way to store the results in
a file, and at best when it takes longer, to store intermediate
results to be able to resume later one (by reading in the partial
results).

The topic in general is called "serialization" and "persistent
storage". The capabilities of python (I'm assuming you work in
Python/Sage) range from range from "pickle" (use the "highest
protocol", not the default [1] over using JSON, up to storing data in
sqlite3 [2].

[1] https://docs.python.org/2/library/pickle.html#usage
[2] https://docs.python.org/2/library/sqlite3.html

-- harald

saad khalid

unread,
Sep 24, 2016, 2:05:46 PM9/24/16
to sage-cloud
Thank you for your response! I don't believe that the timeout quota is the problem unfortunately, I checked and I have 49 hours and I've been doing stuff at least every couple of hours on the project.

I want to try saving the output to a file using Pickle, that sounds very cool. I'm reading this tutorial for help so far:
http://www.diveintopython3.net/serializing.html
 
And I read somewhere that Sage has integrated save/load functions(using pickle as the backend?). Should I just use the save/load functions in sage or import pickle and use it directly?

Another problem with doing this is that my computation is running in macaulay2, using the Sage/M2 interface. Here's how it looks:

macaulay2.eval("""
K = toField(QQ[zet]/(zet^8 - zet^6 + zet^4 - zet^2 + 1))
needsPackage "
InvariantRing"
A = []
B = []
C1 = []
C2 = []
C3 = []
C4 = []
C5 = []
C6 = []
C7 = []
C8 = []
C9 = []
C10 = []
for a1 from 1 to 20 do (for a2 from 1 to 20 do (for a3 from 1 to 20 do A = A|[matrix{{zet^(a1),0,0},{0,zet^(a2),0},{0,0,zet^(a3)}}] ) )
for i from 0 to (#A-1) do B = B|[generateGroup({A#i},K)]
"""
)

last time, my problem was that I was trying to output too large an amount of data from M2 at once, so i split it up into smaller parts this time. That's why I defined the arrays C1 through C10. All the for loop does is give me a long list, B, with every possible diagonalized cyclic group generated when you're dealing with the 20th root of unity in 3x3 matrices. I don't think that part matters much, it works fine, and the array has 8000 matrix groups in in (20^20^20).

Once I have all that stuff defined, I run the following code:
macaulay2.eval("for j from 0 to (799) do C1 = C1|[toString molienSeries B#j]")

This converts the molien series of a group from the array B, converts it into a string, and then stores it in C1.
I have 10 different versions of that line in different cells, the different between them being the start and stop points of the for loop, and which list I have it write to. For example, I have the line for list C2 running from 800 to 1599. What's strange is, the first one(from 0 to 799) works fine, it takes several hours but it does finish computing. Once it's finished, i try running the second one and leave it for a few hours. That one hasn't worked out, whenever I get back on sage to check on it after a few hours, it's crashed and all the previous computations and variables have been reset.  I've written some code to convert the M2 object into a string that I can assign to a variable in Sage, but that only works when the computation has finished in macaulay (it basically just using to_sage() function on C1, C2, etc as they finish computing). Is it possible for me to use pickle to save the M2 computation up until the point it crashes, and then have it pick up where it left off? Or is my only option to make the for loops even shorter?

Thanks!

William Stein

unread,
Sep 24, 2016, 3:05:14 PM9/24/16
to sage-cloud
On Sat, Sep 24, 2016 at 11:05 AM, saad khalid <saad...@gmail.com> wrote:
> Thank you for your response! I don't believe that the timeout quota is the
> problem unfortunately, I checked and I have 49 hours and I've been doing
> stuff at least every couple of hours on the project.
>
> I want to try saving the output to a file using Pickle, that sounds very
> cool. I'm reading this tutorial for help so far:
> http://www.diveintopython3.net/serializing.html
>
> And I read somewhere that Sage has integrated save/load functions(using
> pickle as the backend?). Should I just use the save/load functions in sage
> or import pickle and use it directly?

If you're working with Python objects, use save/load -- straight
pickle mostly doesn't work with Sage.

> Another problem with doing this is that my computation is running in
> macaulay2, using the Sage/M2 interface. Here's how it looks:

However, you're using Macaulay2, so pickle/save/load will be of no use
to you. I don't know if there is any analogue of save/load/pickle for
Macaulay2. If not, you'll have a lot more work to do. You should
write to the Macaulay2 support mailing list.
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-cloud+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-cloud/63460fd3-91be-4e7f-9387-fdcef5cd3279%40googlegroups.com.
>
> For more options, visit https://groups.google.com/d/optout.



--

Best Regards,
William Stein

CEO, SageMath, Inc.
Reply all
Reply to author
Forward
0 new messages