# BlackBoxOptim hangs with multi-threaded optimization

**URL:** <https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454>\
**Category:** Optimization (Mathematical)\
**Tags:** multithreading\
**Created:** [September 20, 2021, 11:49am UTC](https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454 "2021-09-20T11:49:18Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [September 20, 2021, 11:49am UTC](https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454/1 "2021-09-20T11:49:18Z")

</div>

Hi everyone,

I had tried using BlackBoxOptim.jl for a parameter estimation problem, following [this tutorial](https://diffeqparamestim.sciml.ai/stable/tutorials/ODE_inference/). In particular, I have a rather slow intermediate ODE system to solve which does not benefit from multithreading — using the multithreading option in BBO, however, leads to the evaluation failing to continue past the initialization of the workers.

Using [the multithreading example](https://github.com/robertfeldt/BlackBoxOptim.jl/blob/master/examples/multithreaded_optimization.jl) actually demonstrates the issue; the command starting on line 39 generates the correct worker processes (in my case, 3) and displays an @info line in the terminal, but does not progress further; computation proceeds but never completes and never produces further output. The julia session must be interrupted with `^C` to exit.

I’m not sure how to diagnose the issue or what information would be helpful. I would appreciate any help with that. Thanks!

---

<div class="post-metadata">

**Author:** ![PeterSimon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petersimon/32/25193_2.png) [@PeterSimon](https://discourse.julialang.org/u/PeterSimon)\
**Post date:** [September 20, 2021, 4:55pm UTC](https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454/2 "2021-09-20T16:55:17Z")

</div>

I can’t help with BlackBoxOptim, but I suggest that you also give [CMAEvolutionStrategy.jl](https://github.com/jbrea/CMAEvolutionStrategy.jl) a try. It is a very powerful black box optimizer that I’ve used successfully on several difficult optimization problems. The multithreading option has worked flawlessly for me.

---

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [September 21, 2021, 9:25am UTC](https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454/3 "2021-09-21T09:25:15Z")

</div>

Thanks for the tip! CMAEvolutionStrategy does seem to have more reliable multi-threading.

---

<div class="post-metadata">

**Author:** ![cmarcotte](https://avatars.discourse-cdn.com/v4/letter/c/a3d4f5/32.png) [@cmarcotte](https://discourse.julialang.org/u/cmarcotte)\
**Post date:** [September 22, 2021, 2:54pm UTC](https://discourse.julialang.org/t/blackboxoptim-hangs-with-multi-threaded-optimization/68454/4 "2021-09-22T14:54:28Z")

</div>

Have just noticed the following on the BBO page:

> **NB!** There are problems with the multi-threaded evaluation on Julia 1.6 and later. We will be investigating this and hope to fix in a future release. For now the related tests have been deactivated. Sorry for the inconvenience.

I’ll mark this as solved.
