Message Boards Message Boards

0
|
7605 Views
|
10 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Spontaneous clearing of variables and functions in v10

Posted 10 years ago

Having a new problem with v10 that I never had in v9:

When I run an evaluation that is computationally intensive, the evaluation will fail and all defined variables and functions will clear. Here's an example:

I define my variables and functions:

scale = 0.09;
c = GoldenRatio;
vee = 2;
d = 1;
n = 25;
groovewidth = 0.014;
groovedepth = 0.014;
plotpts = 175;
maxrecurs = 0;
minshellthickness = 0.02;

CurveA[i_] := 
 ParametricPlot3D[{scale c Cosh[s/c] Cos[s + (i - 1) (2 Pi)/n] + (
     Sqrt[2] d Cos[s + (i - 1) (2 Pi)/n] Cosh[s/c])/Sqrt[
     Cosh[s/c]^2 (-1 + 2 d^2 + Cosh[(2 s)/c])] t, 
   scale c Cosh[s/c] Sin[s + (i - 1) (2 Pi)/n] + (
     Sqrt[2] d Cosh[s/c] Sin[s + (i - 1) (2 Pi)/n])/Sqrt[
     Cosh[s/c]^2 (-1 + 2 d^2 + Cosh[(2 s)/c])] t, 
   scale d s - 
    Sinh[(2 s)/c]/(
     Sqrt[2] Sqrt[Cosh[s/c]^2 (-1 + 2 d^2 + Cosh[(2 s)/c])])
      t}, {s, -vee Pi - 0.03, vee Pi + 0.03}, {t, -0.06, 0}, 
  PlotStyle -> Thickness[groovewidth], Mesh -> None, 
  MaxRecursion -> maxrecurs, PlotPoints -> plotpts]

This next input works fine the first time:

Export["CurveAseg16.stl", CurveA[16]]

The next one I try, however, will always fail and clear everything.

Export["CurveAseg17.stl", CurveA[17]]

It will work if I go back and redefine everything, but I cannot run several evaluations, one after the other, without the variables and functions clearing spontaneously. Possible cause?

POSTED BY: Bryan Lettner
10 Replies
Posted 10 years ago

Update:

Activity Monitor shows two instances of "MathKernel". During evaluation, one is using 100.1% CPU and between 160-350 MB real memory, and the other is using 0.3% CPU and 65 MB real memory. I'm not really sure how to interpret this or what problems it may indicate.

enter image description here

Here is the code I am using to perform multiple exports in succession (kernal typically quits after 1 export):

Do[Export[StringJoin["CurveAseg", ToString[i, InputForm], ".stl"], 
      CurveA[i]], {i, 1, 64}]
POSTED BY: Bryan Lettner

This is normal. Since v9 there's a second kernel run for the private use of the front end.

POSTED BY: Szabolcs Horvát
Posted 10 years ago

I see. Any ideas why it might be quitting?

POSTED BY: Bryan Lettner

I don't know. It's clearly crashing. You should report this to wolfram support.

An additional data point:

I can reproduce the crash using your exact code on OS X 10.9.4 (Mathematica 10.0.0).

POSTED BY: Szabolcs Horvát
Posted 10 years ago

Thanks Craig.
I'm running Mac OSX 10.6.8

I tried $HistoryLength = 0 to no avail.

Do[Print[i]; Print[Timing[tmp = CurveA[i];]], {i, 1, 50}]

killed the kernel at the 2nd iteration for me the first time, then at the 11th iteration the second time.

Any other ideas for a temporary workaround? Maybe a way to revert to v9 temporarily? I'm now having to babysit code for several hours, whereas i could let it run and leave the computer when I was using v9. Any comments from the Wolfram Team on whether it's a bug and any plans for a fix?

POSTED BY: Bryan Lettner

Hello I've been able to duplicate this.

(M10, Macbook 10.9.4, 16GB. M10 is using the the higher performance of the two graphics cards NVIDIA GeForce GT 750M 2048 MB).

The kernel is quiting and leaving no messages as to why, and did not write anything to the system log. The kernel crashes upon evaluation (not during writing the .stl), but did so only after several evaluations. From a fresh kernel and after evaluating your code:

Do[Print[i]; Print[Timing[tmp = CurveA[i];]], {i, 1, 50}]

The kernel died at the 12th iteration, and then again at the 3rd iteration. So, it appears to be random.

This code is not using very much memory.

tmp = CurveA[18]
N@ByteCount@tmp

indicates that the result is only about 6MB (I am not seeing much of a spike in memory during the computation). The resulting .stl is also only about 6MB.

You can reduce memory usage during a Mathematica session by setting

$HistoryLength = 0 (*or some small positive integer*)

However, I don't think it will help in this particular case.

I'm guessing that this behavior indicates a bug.

POSTED BY: W. Craig Carter
POSTED BY: W. Craig Carter
Posted 10 years ago

Thank you both, that sounds right. Is it safe to say that v10 uses more memory than v9 in some situations? Is there anything I should disable to make it use less memory?

POSTED BY: Bryan Lettner

Hi,

I cannot reproduce that with Bryan's code either, but I have observed a similar behaviour in some notebooks myself. I also believe that the kernel quits.

Cheers, M.

POSTED BY: Marco Thiel
Posted 10 years ago

Hi Bryan,

I'm afraid I can't reproduce your problem, both Export statements evaluate just fine for me (Mathematica 10 on a Windows 7 machine). However, if I were to guess, I'd say that what you're seeing is not a mysterious clearing of variables, but a quitting and restarting of the Kernel. That can happen e.g. when a computation exhausts resources (like memory), so maybe your problem is hiding somewhere in that general direction... But since I don't even see the error, that's obviously just a blind guess.

POSTED BY: Bianca Eifert
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract