Memory issues when running simple program

12 views
Skip to first unread message

Britt Cagnina

unread,
Sep 2, 2021, 1:45:31 PM9/2/21
to sage-support
I'm running SageMath 9.2 on windows (and also tried 9.0 on Ubuntu). My specs are: Intel i5-10600K CPU @ 4.10GHz, 32.0 GB RAM, and a RTX 3060 graphics card.

When I run the following program, it seems to starts leaking memory until all 32 GB is consumed, then crashes. I may be doing something silly in the below example (though it is roughly copy/paste from http://sporadic.stanford.edu/reference/plot3d/sage/plot/plot3d/tachyon.html)

Or perhaps I simply don't have enough memory--which would be odd considering I can ray trace much more complicated objects on Blender with no trouble.

f = lambda t: (t, t^2, t^3)
t = Tachyon(camera_center=(5,0,4))
t.texture('t0', ambient=0.1, diffuse=0.9, specular=0.1,  opacity=1.0, color=(1.0,0,0))
t.light((-20,-20,40), 0.2, (1,1,1))
t.parametric_plot(f, -10, 10,'t', min_depth=20, max_depth=40)
t.save(filename='parametric.png', verbose=0, extra_opts='')

Thanks for the time,
Britt

Nils Bruin

unread,
Sep 2, 2021, 7:45:20 PM9/2/21
to sage-support
I'd suspect the problem is not the ray tracing but the description of the object. Probably, `parametric_plot` produces a description of your shape with tubular segments and with a min_depth=20 it probably produces *very* many of them. So you probably don't get to ray tracing: you're stuck in computing the description of the scene. With smaller numbers for min_depth and max_depth it produces a picture very quickly and with no visible artifacts.

The interface with Tachyon probably ends up constructing the input to Tachyon (which is a text-file description) as a big string in memory, so a scene with very many geometric shapes would indeed pose a significant memory strain (Tachyon would be similarly strained to work with such a description).

Justin C. Walker

unread,
Sep 3, 2021, 12:11:24 AM9/3/21
to SAGE Support
FWIW, I ran this on a 2019 Mac Book Pro (8-core 2.4 GHz Core i9) with 64GB of memory and ~4TB of disk.

The code thrashed the disk with more paging than I have seen in a long time with this much disk. As Nils guesses, it’s the parametric_plot() call that brings things to a halt. I finally killed it after about 4 hours.

Also, memory usage for this python process seemed to stabilize for the last 2-3 hours.

HTH

Justin
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/9bc2b2c9-2e87-484f-97b8-a2541f2ed14dn%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages