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

Multiple threads #242

Open
stumarcus314 opened this issue Aug 26, 2022 · 10 comments
Open

Multiple threads #242

stumarcus314 opened this issue Aug 26, 2022 · 10 comments

Comments

@stumarcus314
Copy link

I am trying to use multiple (24) threads to solve a MILP with SCIP by setting the parallel/maxnthreads parameter. My Julia code is shown below. Based on monitoring htop, it seems like SCIP is only using a single thread. Are there other parameters that can be set to enable multithreading in SCIP?

using JuMP
using SCIP

m = read_from_file("input.mps")
optimizer = SCIP.Optimizer()
MOI.set(optimizer, MOI.RawOptimizerAttribute("parallel/maxnthreads"), 24)
set_optimizer(m, () -> optimizer)

            optimize!(m)
            @show termination_status(m)
            @show primal_status(m)
            @show dual_status(m)
            @show objective_value(m)
@stumarcus314
Copy link
Author

I am using Julia v1.7.3 and these versions of JuMP and SCIP.jl:
"SCIP" => v"0.11.3"
"JuMP" => v"1.1.0"

@matbesancon
Copy link
Member

I believe the parameter used to allow concurrent solve is TPI=tinycthreads
https://scipopt.org/doc/html/md_INSTALL.php
@ambros-gleixner can you confirm? The docs on this is very sparse

@ambros-gleixner
Copy link
Member

Yes, at build time you need to make sure it is built with TPI=omp or TPI=tny.

Otherwise, the parameter is fine, only it is important to trigger the solve not via SCIPsolve(), which is always sequential, but via SCIPsolveConcurrent(). I don't know whether this is interfaced here.

@stumarcus314
Copy link
Author

How is SCIP built (TPY= none, omp, or tny) when obtained in Julia as a package?

@matbesancon
Copy link
Member

matbesancon commented Sep 29, 2022 via email

@stumarcus314
Copy link
Author

stumarcus314 commented Sep 29, 2022

If SCIP is built with TPY = tny, the default concurrent/scip.../prefprio parameters (https://www.scipopt.org/doc/html/PARAMETERS.php) are used, and the max and min number of threads parallel/maxnthreads and parallel/minnthreads are set to 4, will the SCIP solver of type < scip > use 4 threads? Or will SCIP invoke 4 solver instances of type < scip >, each in it own thread?

@ambros-gleixner
Copy link
Member

The latter.

@ambros-gleixner
Copy link
Member

But random seeds and child selection rules will be different.

@ianfiske
Copy link

Is this still an issue? I see that Yggdrasil's build script has TPY = tny: https://github.com/JuliaPackaging/Yggdrasil/blob/b63ce418a9a21dbfc79728b50e8d8d664e9dfc9a/S/SCIP/build_tarballs.jl#L35

@matbesancon
Copy link
Member

there are experiments in the branch concurrent, but I would say SCIP concurrent is very experimental and not polished at the moment, which is why it's not merged yet.

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

4 participants