Mathematics tools

maxima optimization for Stack 4.0

 
Picture of C. T. Shieh
maxima optimization for Stack 4.0
 

Dear All,

I upgrade stack 3.0  to 4.0 this morning, after then, I tried to  optimize maxima, my environment  is

ubuntu 16.04 LTS + SBCL 1.3.1 + MAXIMA 5.39, 

 while I type  under maxima

load("path/stackmaxima.mac');

 I got a message "INFO: Control stack guard page unprotected"

Then the sbcl halted .

It never happened for Stack 3.0


Any idea ?

Thank you very much for your assistance.


C. T. 

 
Average of ratings: Useful (1)
Picture of Laurent BRIEND
Re: maxima optimization for Stack 4.0
 
Hi.
Idem for me.
No idea.
Chris ? Tim ?
Thanks.
I killed maxima processus to exit and switched to Linux non optimised.

I ran the heathcheck script.
OK CAS
OK maxima image
OK library version

BUT 2 display bugs :
1. La dérivée de @ x^4/(1+x^4) @ est \displaystyle  \frac{d}{dx} \frac{x^4}{1+x^4} = @ diff(x^4/(1+x^4),x) @.

2. Deux exemples de tracés. @plot([x^4/(1+x^4),diff(x^4/(1+x^4),x)],[x,-3,3])@ @plot([sin(x),x,x^2,x^3],[x,-3,3],[y,-3,3])@
(no graphics)

Laurent Briend
 
Average of ratings: -
Picture of Laurent BRIEND
Re: maxima optimization for Stack 4.0
 

The @ symbol isn't reconised.

Moodle 3.1.1 (build 20170710)

Stack 4.0.1

Maxima 5.36.1 using Lisp SCBL 1.2.4.debian

Debian server

Laurent Briend



 
Average of ratings: -
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

It appears that there has been a change in the delimiters from @ x @ to {@ x @}. This ought to be able to be fixed in old questions with the delimiter script, but that did not work for me, nor did changing delimiters manually in old questions.

I was able to create a new question with the new delimiters and it worked.

 
Average of ratings: -
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

I found that editing the question, checking the 'fix dollars' box, and saving updates the question to work with the new delimiter. However, this is a slow process without the optimization turned on.

 
Average of ratings: -
Picture of Mikko Ranta
Re: maxima optimization for Stack 4.0
 

Hi,

I have a similar problem, when I am trying to optimize Maxima.
When I type in

load("path/stackmaxima.mac');

, Maxima halts. It does not give any errors, just freezes.

Everything is working fine when I use non-optimized version. Also the delimiter update worked for me.

The non-optimized version is too slow for my server, so this is a little bit acute problem for me.

Thanks for your assistance!

Mikko

 
Average of ratings: -
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

I do not think that this problem is caused by the upgrade in STACK, but instead by a security patch to the system (perhaps CVE-2017-1000366). I can not get older versions of STACK to compile an optimized image either anymore with stock maxima.

On CENTOS, I recompiled the maxima package from source, and after that the optimization worked. I have not found a fix yet for ubuntu.

 
Average of ratings: -
Picture of Laurent BRIEND
Re: maxima optimization for Stack 4.0
 

Hi,

I upgraded to Debian Stretch, old maxima erased and new install of maxima.

With this version of Debian :

###

Maxima 5.38.1 http://maxima.sourceforge.net
using Lisp GNU Common Lisp (GCL) GCL 2.6.12

###

Note that it isn't SCBL.

For the optimisation, the documentation for GCL says :

  • Get STACK working with Platform type set to 'Linux'. Run the health-check. It is important to do this every time you upgrade your version.
    load("<path>/maximalocal.mac");
    load("<path>/stackmaxima.mac");
    load(stats);
    load(distrib);
    load(descriptive);
    :lisp (si::save-system "/path/to/moodledata/stack/maxima-optimised")  
    quit();
  • Go into the STACK settings and set Platform type to 'Linux (Optimised)'.
  • Set Maxima command to.

    /path/to/moodledata/stack/maxima-optimised -eval '(cl-user::run)'


I tried and :
- OK for
 load("<path>/maximalocal.mac");
- Bug with :
 load("<path>/stackmaxima.mac");
"Maxima encountered a Lisp error:

 Condition in MACSYMA-TOP-LEVEL [or a callee]: INTERNAL-SIMPLE-ERROR: Value stack overflow.

Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil."


But I have now the linux optimised version of maxima : Healthcheck returns 
"unix-optimised
OK    CAS a retourné les données comme prévu. Vous êtes bien connecté à CAS.
OK    Version de librairie STACK-Maxima correcte et attendue (2017082400).
    Les résultats de CAS ont été placé dans la base de données."

Any idea to fix the bug and complete the linux optimised version of maxima ?

Laurent Briend from France.
 
Average of ratings: -
Picture of Joël Schmid
Re: maxima optimization for Stack 4.0
 

Hello Daniel

What maxima version did you use? 5.38.1.?

Furthermore, how did you come to the conclusion, that the security patch might be causing this issue?

Thank you in advance for your help!

Cheers, Joël

 
Average of ratings: -
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

Hello Joël,

On my development system, I removed STACK and reinstalled an earlier version of STACK which I had optimized before and still experienced the same issue now. I am assuming that means something else on the system changed. I searched for some the lisp error and found some reports of recent security fixes causing that error.

My development system is Ubuntu 17.04. I followed the instructions from Artem and it resolved the issue for me there. In production, we are running CENTOS 6 will SBLC and Maxima 38.1 which is compiled from the source RPM. After I could not optimize STACK, I rebuilt the maxima from source again. As far as I know that was the only change I made and then the optimization worked.

Daniel

 
Average of ratings: -
Picture of Artem Zaloga
Re: maxima optimization for Stack 4.0
 
Same issue here and after much fiddling the best I could get is the following:

Go to Site Admin. > Plugins > Question Type > STACK: In the Stack menu keep Platform as 'Linux', keep CAS connection timeout as default (or set higher if you're getting CAS connection errors in the healthcheck script), set Maxima command to '/path/to/maxima', then just run the healthscript.

Assuming all goes well it will spit out OK's at the bottom (if not, first thing to try is clearing cache and checking for typos in maxima path), click 'Create Maxima image' and copy the 'timeout --kill-after=10s 10s /path/to/maxima_opt_auto'

Go back to the STACK menu and now change platform to 'Linux (optimized)', lower the CAS connection timeout (I got it at 5), and set the Maxima command to 'timeout --kill-after=10s 10s /path/to/maxima_opt_auto' (what you got from the healthcheck)

Re-run the healthcheck to make sure it worked okay. I have not used STACK in the past (new to Moodle in general to be honest) so I'm not sure how this compares to optimizing it the way it says in the docs, but it appears that this creates an auto-optimized image that does indeed run STACK much faster.

**
Also (not sure if this is necessary, but just in case it is), assuming you compiled Maxima from source and are getting the following error when you run maxima in terminal:
WARNING: Maxima is unable to set up the help system.
(Details: CL-INFO::LOAD-PRIMARY-INDEX: Couldn't load
"/usr/share/info/./maxima-index.lisp":
                                        file does not exist.)
Go into that directory (/usr/share/info/) and make sure that the maxima files located there are uncompressed (they were all compressed for me). If you didn't get that error when you compiled - great - but I got every time I compiled Maxima no matter what version I was compiling, and I was fixing this at the same time as I was trying to optimize STACK so I include it here just in case it is necessary to eliminate this maxima error for stack to function/optimize properly.
**

Hope that helps,
A.Z.
 
Average of ratings: Useful (2)
Picture of Laurent BRIEND
Re: maxima optimization for Stack 4.0
 

Hi,

I only want to add that we tried Stack in production and it works well although there were errors during the optimization process (see above).

Laurent Briend

 
Average of ratings: -
Picture of Joël Schmid
Re: maxima optimization for Stack 4.0
 

Hmm not even sure if we have the same problem as described above... 

We're running STACK 4.0.1 with maxima Version 5.38.0 and SBLC 1.3.11 on CentOS 7. 
When trying to optimize STACK, I get the following error:

INFO: Control stack guard page unprotected
Control stack guard page temporarily disabled: proceed with caution Maxima encountered a Lisp error:
 Control stack exhausted (no more space for function call frames).
This is probably due to heavily nested or infinitely recursive function
calls, or a tail call that SBCL cannot or has not optimized away.
PROCEED WITH CAUTION.
Automatically continuing.
To enable the Lisp debugger set *debugger-hook* to nil.

Sometimes it runs trough, however the result is always the same, the STACK healthcheck page indicates, that it can't connect to CAS.

Is someone with a similar setup experiencing the same behaviour?


 
Average of ratings: -
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

I am pretty sure it is the same issue. The error message varies with OS and lisp implementation, but includes a reference to 'stack guard page'. Are you using maxima-38.0 from EPEL repo or did you try rebuilding it from source? I was receiving a similar error on CENTOS 6, but since I rebuilt the maxima package it optimizes consistently.

 
Average of ratings: Useful (1)
Picture of Daniel Thies
Re: maxima optimization for Stack 4.0
Core developersParticularly helpful MoodlersPlugin developersTesters

Maxims 5.38.1 works for me, but I tried 5.38.0 and it does not 

 
Average of ratings: Useful (1)
Picture of Joël Schmid
Re: maxima optimization for Stack 4.0
 

Hello Daniel

Awesome! Thanks for the information! I'm going to do the same as soon as I have the opportunity, as we don't have a test platform running CentOS, but only a productive one! At the moment we have maxima installed from the EPEL repo. 

Cheers

 
Average of ratings: -