-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Out of memory errors #87
Merged
Merged
Conversation
This file contains 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
With some extra work (calling
|
4e46b0c
to
c11c686
Compare
5b29beb
to
16d6ba2
Compare
Implemented for - Minisat - Glucose - CaDiCaL
If, e.g., features v1-7-0 and v1-5-2 are selected now, CaDiCaL 1.7.0 will be compiled but flipping literals will not be available in RustSAT. To avoid this however, the conditions around the flipping code would need to be updated with every update to the CaDiCaL backend, which is prone to be forgotten.
- `panic_instead_of_abort` to cause a Rust panic on Kissat abort - `call_instead_of_abort` to set up a custom hook function that is called on Kissat abort
extend `OutOfMemory` error and make `CollectClauses` and encodings return it if not enough memory is available
7267688
to
286f92a
Compare
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.
Description of the Contribution
This PR contains new features to deal with cases where the solvers or other parts run out of memory. Making the entire library memory allocation safe is not feasible, but most solvers and clause collection when generating encodings should be possible.
resolves #79
Testing this in CI is difficult since it requires limiting memory. Here is what I did to reproduce and test this. I first implemented an example to be able to use MiniSAT through RustSAT from the CLI. I then ran the generated binary on this CNF instance with memory limited to 40000 KiB with the following result:
This is the behaviour reported in #79.
With the changes of this PR, this behaviour changes to the following:
From the fact that
s UNKNOWN
is printed, it can be seen that the error is caught appropriately. Since theanyhow
error can come from different sources, an out of memory error can be detected by usingdowncast
to theOutOfMemory
type.If the memory is so limited that initialization of the solver fails already, the implementation panics, since
Solver::default
cannot return an error.PR Checklist
CONTRIBUTING.md
rustfmt
/cargo fmt --all