2

I'm using PySAT. Is there a threads number parameter somewhere? Or a packaged solver that can be parallelized in this way?

(Currently, I'm using the Glucose4 solver.)

corazza
  • 31,222
  • 37
  • 115
  • 186
  • Related, but not what you are asking for: https://github.com/pysathq/pysat/issues/49 – D.W. Feb 08 '21 at 06:50
  • I've opened my issue [here](https://github.com/pysathq/pysat/issues/70) and there is a method to sort of do this, but it's not really universal. The trick is to case-split on `n` variables, in that way you can utilize `2^n` cores. You solve the same formula in each thread, but with `True/False` substituted for those variables, and hopefully it's faster – corazza Feb 10 '21 at 16:48

1 Answers1

1

I dug into the source code, and the answer seems to be no.

The only reference to threading in the PySAT codebase is some code that checks whether the current thread is the ‘main’ one and adjusts signal handling logic based on that. Nothing in the library allows the user to control the level of parallelism used by the actual solver.

The best workaround was mentioned by the asker in the comments: manually split the problem space into sub-cases that can be independently solved in parallel. Fortunately enough, SAT lends itself to that approach particularly easily.

Reposting comment:

The trick is to case-split on n variables, in that way you can utilize 2^n cores. You solve the same formula in each thread, but with True/False substituted for those variables, and hopefully it's faster

corazza
  • 31,222
  • 37
  • 115
  • 186
user3840170
  • 26,597
  • 4
  • 30
  • 62
  • I edited in my comment so it can be found more easily because it's *slightly* more concrete about what you actually have to do – corazza Feb 12 '21 at 16:46