Skip to content
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

Parallelisation support #49

Open
ChrisJefferson opened this issue Jun 24, 2020 · 12 comments
Open

Parallelisation support #49

ChrisJefferson opened this issue Jun 24, 2020 · 12 comments
Labels
enhancement New feature or request

Comments

@ChrisJefferson
Copy link
Contributor

I was wondering if there is any current support for parallelisation (I want to solve multiple SAT problems at the same time).

Is either Python threads (you could release the GIL?), or multiprocessing supported?

@alexeyignatiev
Copy link
Collaborator

As far as I understand, nothing should prevent PySAT to be used in parallel using let's say threading. I haven't tried it myself, but I remember implementing signal handling to support multiple threads. So it should work I guess. But it is better to try. :)

@alexeyignatiev alexeyignatiev added the enhancement New feature or request label Jul 27, 2020
@WonJayne
Copy link

Let me just add that I've successfully used pysat with multiprocessing in python @alexeyignatiev.

@alexeyignatiev
Copy link
Collaborator

alexeyignatiev commented Dec 25, 2020

That's great to know, @WonJayne! Can you share some concrete recipe with us so that I could probably add it to the documentation? (Because, as I mentioned before, I haven't tried multiprocessing with PySAT myself.)

@WonJayne
Copy link

@alexeyignatiev Sure. I'll prepare an example, such that you can integrate it. I'll try to follow the style of the existing examples.

I think having a small example is actually quite valuable, as the wrong usage of subprocesses can cause out of memory errors (when the solver instance is not deleted). I'll let you know, when the example is ready.

Let me use this possibility to thank you for this exceptional package, it enabled me to do a great thesis!

@alexeyignatiev
Copy link
Collaborator

@WonJayne great to know that the toolkit was of help, thanks! :) And thank you for preparing the example. I believe it will be useful for a wide audience of users!

@alexeyignatiev
Copy link
Collaborator

@WonJayne, by any chance, did you manage to prepare the example? :)

@alexeyignatiev
Copy link
Collaborator

@WonJayne, please let me know if your use of PySAT in parallel was done in a similar vein.

@WonJayne
Copy link

WonJayne commented Mar 24, 2022

Hi @alexeyignatiev

Indeed, I used PySat in parallel in a similar vein.

However, in the mean time, I found an alternative way to leverage your awesome work and a parallel solver, CryptoMiniSat. CMS is cool, as it supports both single and multithreaded usage and offers incremental usage.

The integration works as follows: I put together a wrapper (crypto_mini_sat.zip) around the Solver of PyCryptoSat, the Python version of CMS, such that one can swap the solvers freely and installed PyCryptoSat with pypi. However, there's one caveat: Currently, the most recent version of CMS that is available for windows is 5.7.0, which is known to suffer from a memory related bug, causing excessive solving times for some cases.

But there's light at the end of the tunnel: The most up to date version of CMS should no longer suffer from that, as it has been fixed. Furthermore, in this comment, it is stated that PyCryptoSat will soon be available on PyPi.

Hence, I would propose the following to integrate CMS in the near Future:
Add a wrapper for CMS to pySat and get PyCryptoSat via PyPi. What is your opinion on that? I see that this is a deviation from your usual pattern of how you implement solvers, so let me know if you think this is worth a try.

@alexeyignatiev
Copy link
Collaborator

Hi @WonJayne,

I do like the idea. In fact, @msoos and I discussed this in July 2020. My concern was the limited incremental functionality offered by CMS at that time. Not sure what the status is now. Having said that, I see no issue in integrating CMS through a high-level dependency on PyPI.

@WonJayne
Copy link

Great that you like the Idea of integration via PyPI. Just out of curiosity, what is your concern with limited incremental functionality? The get_conflict method is available since May 2019. Are there more things needed for incremental solving?

@alexeyignatiev
Copy link
Collaborator

Well, there were quite a few methods in the list here missing in CMS at that point.

@WonJayne
Copy link

I see. Could have figured out that myself, since my wrapper has lot's of NotImplemented exceptions for the missing methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants