scipopt / PySCIPOpt

Python interface for the SCIP Optimization Suite
https://pyscipopt.readthedocs.io/en/latest/
MIT License
826 stars 255 forks source link

Segfault when calling `solveConcurrent()` when SCIP is compiled with `TPI=tny` #883

Open waweber opened 3 months ago

waweber commented 3 months ago

Describe the bug Calling solveConcurrent() segfaults when using SCIP with the tinycthread task implementation.

To Reproduce Run a model with solveConcurrent() with SCIP compiled with this option.

Expected behavior The solver should run without error.

System Fedora Linux 40, SCIP 9.1.0, compiled from source

Additional context

solveConcurrent() calls SCIPtpiGetNumThreads(), but SCIPtpiGetNumThreads() for tinycthread requires SCIPsyncstoreInit to be called first, otherwise a null pointer dereference occurs. SCIPsyncstoreInit is normally called by SCIPsolveConcurrent().

Removing the check in solveConcurrent() results in the correct behavior.

I also tried with OpenMP as the task implementation, but PySCIPOpt reported that no task processing implementation was compiled. I suspect this is also due to SCIPtpiGetNumThreads() being called before the required initialization happens.

Opt-Mucca commented 3 months ago

Thanks for pointing this out! We're aware of the issue, and have been working on it.

If you compile the current master branch of SCIP then this should hopefully be resolved. If not then we will look into it more. We are waiting for the next release of SCIP and then we will be releasing PySCIPOpt by default with tny via PyPI.