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

Insuppressible debug print from multithreaded SCIP runs #61

Open
amotzop opened this issue Sep 1, 2023 · 1 comment
Open

Insuppressible debug print from multithreaded SCIP runs #61

amotzop opened this issue Sep 1, 2023 · 1 comment

Comments

@amotzop
Copy link

amotzop commented Sep 1, 2023

This is a problem I encountered when running SCIP using google's ortools (as I wasn't able to correctly install and run SCIP in as a standalone library).
I posted it as an issue in the ortools repo (google/or-tools#3742), thinking it's a bug on their side, but from the response I got and looking at their code it seems like a bug in SCIP.

The problem is that when setting the SCIP message handler to be quiet and then running a multi-threaded solver, the individual threads do print messages when they are initialized/start/stop (as can be seen in the referenced issue).

Sorry for only giving a reference this problem when SCIP is being wrapped in another solver.

@svigerske
Copy link
Member

This should help:

diff --git a/src/scip/concsolver_scip.c b/src/scip/concsolver_scip.c
index e8145ab5bf..8c42305361 100644
--- a/src/scip/concsolver_scip.c
+++ b/src/scip/concsolver_scip.c
@@ -272,6 +272,7 @@ SCIP_RETCODE initConcsolver(
 
    /* create the concurrent solver's SCIP instance and set up the problem */
    SCIP_CALL( SCIPcreate(&data->solverscip) );
+   SCIPsetMessagehdlrQuiet(data->solverscip, SCIPmessagehdlrIsQuiet(SCIPgetMessagehdlr(scip)));
    SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(data->solverscip), data->nvars) );
    SCIP_CALL( SCIPcopy(scip, data->solverscip, varmapfw, NULL, SCIPconcsolverGetName(concsolver), TRUE, FALSE, FALSE,
          FALSE, &valid) );

But the problem is actually that concsolver_scip.c shouldn't use the "solverscip"''s message handler, but the one from the main SCIP (which it doesn't have easy access to when printing these messages). Or it takes care of passing the solverscip's messages to the message handler of the main SCIP.

scip-ci pushed a commit that referenced this issue Sep 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants