Repository navigation
Report failed computations in positive characteristic - #371
Merged
mohabsafey merged 2 commits intoOct 2, 2026
Merged
Conversation
When msolve_trace_qq detects that the Groebner basis has a wrong dimension or degree it returned 4 without freeing its data, and core_msolve then restarted without freeing the arrays allocated at the beginning of each run. Free both before returning, resp. restarting. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
In positive characteristic core_msolve always returned 0, even when the computation failed, and it ignored the status 4 returned by msolve_trace_qq when probabilistic linear algebra yields a wrong dimension or degree. In that case msolve wrote an empty output file and exited with status 0. Now status 4 restarts the computation with the same linear form, as is already done in characteristic 0, and any remaining failure makes core_msolve return 1 and marks the parametrization as invalid. The test nonradical-radicalshape-no-square-31 with -c 0 relied on the former behaviour and now expects a nonzero exit status. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
wegank
marked this pull request as ready for review
October 1, 2026 09:48
ederc
approved these changes
Oct 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In positive characteristic, msolve can fail, print "Computation failed", and still exit with status 0, leaving an empty output file. For example, without genericity handling (
-c 0):There are two reasons:
core_msolvealways returned 0, even after printing "Computation failed". This is what happens in the example above.msolve_trace_qqreturns 4. This can happen when probabilistic linear algebra is unlucky. In characteristic 0,core_msolverestarts the computation in that case. In positive characteristic this status was ignored: nothing was written and the computation was considered done.Changes
msolve_trace_qqreturned 4 without freeing its data. It now callsfree_msolve_trace_qq_initial_datafirst, as its other return paths do.core_msolverestarted without freeing the arrays allocated at the start of each run (bld,blen,bexp,bcf,param). They are now freed beforegoto restart.core_msolvereturn 1, somsolveexits with status 1. When the status is positive it also setsmpz_param->dim = -1, so the Julia interface reports the failure instead of exporting a parametrization.Behaviour change
A computation that fails in positive characteristic now exits with status 1 instead of 0. In the example above the output file is still empty, but msolve now exits with status 1.
The test
test/diff/diff_nonradical-radicalshape-no-square-31.shruns this input with-c 0and relied on the old exit status. It now expects a nonzero exit status, and still checks that the output file is empty.Tests
-c 0, it succeeds and exits with status 0 as before.make checkpasses for this branch on top ofmaster, and also with the linear algebra PR applied first.make distcheckpasses, also withSEED=1617753600.-l 42oninput_files/nonradical-radicalshape-31.msfor seeds 1..40 no longer gives an empty output file with exit status 0: each failing run either recovers by restarting or exits with status 1.Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com