Skip to content
Snippets Groups Projects
Commit 7418aeb6 authored by Chris Sangwin's avatar Chris Sangwin
Browse files

Auto-generate the maxima image on plugin upgrade, if appropriate.

parent 943c2f50
Branches
No related tags found
No related merge requests found
......@@ -837,6 +837,12 @@ function xmldb_qtype_stack_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2020041400, 'qtype', 'stack');
}
if ($oldversion < 2020112100) {
if (get_config('qtype_stack', 'platform') == 'unix' || get_config('qtype_stack', 'platform') == 'unix-optimised') {
set_config('platform', 'linux', 'qtype_stack');
}
}
// Add new upgrade blocks just above here.
// Check the version of the Maxima library code that comes with this version
......@@ -855,9 +861,18 @@ function xmldb_qtype_stack_upgrade($oldversion) {
// Update the record of the currently used version.
set_config('stackmaximaversion', $latestversion, 'qtype_stack');
// If appropriate, clear the CAS cache.
// If appropriate, clear the CAS cache and re-generate the image.
if ($latestversion != $currentlyusedversion) {
stack_cas_connection_db_cache::clear_cache($DB);
if (QTYPE_STACK_TEST_CONFIG_PLATFORM !== 'server') {
$pbar = new progress_bar('healthautomaxopt', 500, true);
list($ok, $message) = stack_cas_configuration::create_auto_maxima_image();
$pbar->update(500, 500, get_string('healthautomaxopt', 'qtype_stack', array()));
if (!$ok) {
echo html_writer::div($message, 'adminwarning');
echo html_writer::div(get_string('healthautomaxoptintro', 'qtype_stack'), 'adminwarning');
}
}
}
return true;
......
# Optimising Maxima
There are several ways to reduce the access and execution time of this CAS which can prove useful for scaling. They have the potential to greatly speed up STACK, and are widely used. It is particularly important on a Linux system to compile the Maxima code. Please let us know if you try them.
There are several ways to reduce the access and execution time of this CAS which can prove useful for scaling. They have the potential to greatly speed up STACK, and are required on a production server. It is particularly important on a Linux system to compile the Maxima code.
The instructions for both CLISP and SBCL have been tested and work in STACK 3. As of November 2020, these are working with all versions between Maxima 5.36.1 and Maxima 5.44.0.
The procees of creating an optimised Maxima image is now automated. This should be built automatically when installing STACK, and on upgrade. However, you should use the plugin healthcheck script to confirm you have a fully working system.
For developers the code to automatically generate the LISP images is described below.
The instructions for both CLISP and SBCL have been tested and work in STACK 3. As of November 2015, these are working with Maxima 5.36.1, but some versions of Maxima do have problems. We now have some code to attempt to automatically generate the LISP images described below. Beware, however, that when regenerating the image you may have to manually delete the old image which may be write-protected.
## Terminating runaway LISPS ##
......
......@@ -595,7 +595,7 @@ $string['healthuncachedstack_CAS_versionnotchecked'] = 'You have chosen the "def
$string['healthuncachedstack_CAS_calculation'] = 'Expected CAS calculation : {$a->expected}. Actual CAS calculation: {$a->actual}.';
$string['healthunabletolistavail'] = 'Platform type not currently set to "linux", so unable to list available versions of Maxima.';
$string['healthautomaxopt'] = 'Automatically create an optimised Maxima image';
$string['healthautomaxoptintro'] = 'For best performance we need to optimize maxima on a linux machine. See the <a href="doc/doc.php/CAS/Optimising_Maxima.md">documentation</a> on this issue.';
$string['healthautomaxoptintro'] = 'For best performance we need to optimize maxima on a linux machine. Use the plugin "healthcheck" page and see the documentation on this issue.';
$string['healthautomaxopt_succeeded'] = 'Create Optimised Maxima Image SUCCEEDED';
$string['healthautomaxopt_failed'] = 'Create Optimised Maxima Image FAILED : [{$a->errmsg}]';
$string['healthautomaxopt_ok'] = 'Maxima image created at: <tt>{$a->command}</tt>';
......
......@@ -3047,5 +3047,5 @@ load(linearalgebra);
/* Stack expects some output with the version number the output happens at */
/* maximalocal.mac after additional library loading */
stackmaximaversion:2020112100$
stackmaximaversion:2020112200$
......@@ -24,7 +24,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2020112100;
$plugin->version = 2020112200;
$plugin->requires = 2018051700;
$plugin->cron = 0;
$plugin->component = 'qtype_stack';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment